NDEVR
API Documentation
Exception.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Base
28File: Exception
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/File.h>
34#include "Exception.hpp"
35
36namespace NDEVR
37{
42 class FileException : public Exception
43 {
44 public:
60
61 public:
67 NDEVR_BASE_API explicit FileException(const File& file, ExceptionType type = e_generic);
74 NDEVR_BASE_API FileException(const File& file, const TranslatedString& message, ExceptionType type = e_generic);
79 const File& getFile() const { return m_file; }
84 ExceptionType getType() const { return m_type; }
85 private:
90 void createDescription(const TranslatedString& message);
91 File m_file;
92 const ExceptionType m_type;
93 };
94
98 class CancelException : public Exception
99 {
100 public:
104 NDEVR_BASE_API CancelException();
109 NDEVR_BASE_API CancelException(const TranslatedString& message);
110 };
111}
112
113
CancelException(const TranslatedString &message)
Constructs a CancelException with a custom cancellation message.
CancelException()
Constructs a CancelException with a default cancellation message.
FileException(const File &file, ExceptionType type=e_generic)
Constructs a FileException for the given file and error type.
ExceptionType getType() const
Returns the type of file error that occurred.
Definition Exception.h:84
ExceptionType
Categorizes the type of file error that occurred.
Definition Exception.h:49
@ e_file_exits
The file already exists when a new file was expected.
Definition Exception.h:54
@ e_no_create
The file could not be created.
Definition Exception.h:58
@ e_already_open
The file is already open by another process or handle.
Definition Exception.h:52
@ e_does_not_exist
The file does not exist at the specified path.
Definition Exception.h:53
@ e_no_open
The file could not be opened.
Definition Exception.h:51
@ e_file_invalid
The file is invalid or corrupted.
Definition Exception.h:55
@ e_not_supported
The file format or operation is not supported.
Definition Exception.h:57
@ e_generic
A generic, unspecified file error.
Definition Exception.h:50
@ e_checksum_failed
The file checksum verification failed.
Definition Exception.h:56
FileException(const File &file, const TranslatedString &message, ExceptionType type=e_generic)
Constructs a FileException for the given file with a custom message and error type.
const File & getFile() const
Returns the file associated with this exception.
Definition Exception.h:79
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
The primary namespace for the NDEVR SDK.
@ type
The type identifier string for this model node.
Definition Model.h:58
@ file
The source file path associated with this object.