RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
FileError.h
1/***********************************************************************
2 * The rDock program was developed from 1998 - 2006 by the software team
3 * at RiboTargets (subsequently Vernalis (R&D) Ltd).
4 * In 2006, the software was licensed to the University of York for
5 * maintenance and distribution.
6 * In 2012, Vernalis and the University of York agreed to release the
7 * program as Open Source software.
8 * This version is licensed under GNU-LGPL version 3.0 with support from
9 * the University of Barcelona.
10 * http://rdock.sourceforge.net/
11 ***********************************************************************/
12
13// rxdock file-based exceptions
14
15#ifndef _RBTFILEERROR_H_
16#define _RBTFILEERROR_H_
17
18#include "rxdock/Error.h"
19
20namespace rxdock {
21
22const std::string IDS_FILE_ERROR = "RBT_FILE_ERROR";
23const std::string IDS_FILE_READ_ERROR = "RBT_FILE_READ_ERROR";
24const std::string IDS_FILE_WRITE_ERROR = "RBT_FILE_WRITE_ERROR";
25const std::string IDS_FILE_PARSE_ERROR = "RBT_FILE_PARSE_ERROR";
26const std::string IDS_FILE_MISSING_PARAMETER = "RBT_FILE_MISSING_PARAMETER";
27const std::string IDS_DIR_NOACCESS = "RBT_DIR_NOACCESS";
28const std::string IDS_NO_FILEINDIR = "RBT_NO_FILEINDIR";
29const std::string IDS_NOENV = "RBT_NO_ENVIRONMENT";
30const std::string IDS_STRINGTOOLONG = "RBT_SRINGTOOLONG";
31
32// Unspecified file error
33class FileError : public Error {
34public:
35 FileError(const std::string &strFile, int nLine,
36 const std::string &strMessage = "")
37 : Error(IDS_FILE_ERROR, strFile, nLine, strMessage) {}
38 // Protected constructor to allow derived file error classes to set error name
39protected:
40 FileError(const std::string &strName, const std::string &strFile, int nLine,
41 const std::string &strMessage = "")
42 : Error(strName, strFile, nLine, strMessage) {}
43};
44
45// File read error
46class FileReadError : public FileError {
47public:
48 FileReadError(const std::string &strFile, int nLine,
49 const std::string &strMessage = "")
50 : FileError(IDS_FILE_READ_ERROR, strFile, nLine, strMessage) {}
51};
52
53// File write error
54class FileWriteError : public FileError {
55public:
56 FileWriteError(const std::string &strFile, int nLine,
57 const std::string &strMessage = "")
58 : FileError(IDS_FILE_WRITE_ERROR, strFile, nLine, strMessage) {}
59};
60
61// File parse error
62class FileParseError : public FileError {
63public:
64 FileParseError(const std::string &strFile, int nLine,
65 const std::string &strMessage = "")
66 : FileError(IDS_FILE_PARSE_ERROR, strFile, nLine, strMessage) {}
67};
68
69// Missing parameter error
71public:
72 FileMissingParameter(const std::string &strFile, int nLine,
73 const std::string &strMessage = "")
74 : FileError(IDS_FILE_MISSING_PARAMETER, strFile, nLine, strMessage) {}
75};
76
77// Exceptions for DirectorySource and derived classes:
78//
79// Directory access error
81public:
82 DirIsNotAccessible(const std::string &strFile, int nLine,
83 const std::string &strMessage = "")
84 : FileError(IDS_DIR_NOACCESS, strFile, nLine, strMessage) {}
85};
86
87// Directory contains no file with that extension
88class NoFileInDir : public FileError {
89public:
90 NoFileInDir(const std::string &strFile, int nLine,
91 const std::string &strMessage = "")
92 : FileError(IDS_NO_FILEINDIR, strFile, nLine, strMessage) {}
93};
94
95// Misc exceptions
96//
97// If path is missing
98class EnvNotDefined : public FileError {
99public:
100 EnvNotDefined(const std::string &strFile, int nLine,
101 const std::string &strMessage = "")
102 : FileError(IDS_NOENV, strFile, nLine, strMessage) {}
103};
104
105// If string is too long
106class StringTooLong : public FileError {
107public:
108 StringTooLong(const std::string &strFile, int nLine,
109 const std::string &strMessage = "")
110 : FileError(IDS_STRINGTOOLONG, strFile, nLine, strMessage) {}
111};
112
113} // namespace rxdock
114
115#endif //_RBTFILEERROR_H_
Definition FileError.h:80
Definition FileError.h:98
Definition Error.h:59
Definition FileError.h:33
Definition FileError.h:70
Definition FileError.h:62
Definition FileError.h:46
Definition FileError.h:54
Definition FileError.h:88
Definition FileError.h:106