-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImageException.h
64 lines (52 loc) · 1.78 KB
/
ImageException.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* -----------------------------------------------------------------
* File: ImageException.h
* Created: 2015-08-29
* -----------------------------------------------------------------
* 6.815/6.865 Image Exceptions
*
*
* ---------------------------------------------------------------*/
#ifndef __IMAGEEXCEPTION__H
#define __IMAGEEXCEPTION__H
#include <stdexcept>
class DivideByZeroException : public std::runtime_error {
public:
DivideByZeroException() :
std::runtime_error("Divisor is zero") {}
};
class MismatchedDimensionsException : public std::runtime_error {
public:
MismatchedDimensionsException() :
std::runtime_error("Image dimensions are not the same.") {}
};
class NegativeDimensionException : public std::runtime_error {
public:
NegativeDimensionException() :
std::runtime_error("Image dimensions must be nonnegative.") {}
};
class ChannelException : public std::runtime_error {
public:
ChannelException() :
std::runtime_error("Number of channels must be 1, 3 or 4 when writing to image.") {}
};
class OutOfBoundsException : public std::runtime_error {
public:
OutOfBoundsException() :
std::runtime_error("Index is out of the image bounds.") {}
};
class InvalidArgument : public std::runtime_error {
public:
InvalidArgument() :
std::runtime_error("Argument is not valid.") {}
};
class FileNotFoundException : public std::runtime_error {
public:
FileNotFoundException() :
std::runtime_error("Empty input or file does not exist.") {}
};
class NotImplementedException : public std::runtime_error {
public:
NotImplementedException() :
std::runtime_error("Method not implemented") {}
};
#endif