Exception: Proj::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Proj::Error
- Defined in:
- lib/proj/error.rb
Overview
Represents error thrown by Proj
Constant Summary collapse
- PROJ_ERR_INVALID_OP =
Error codes typically related to coordinate operation initialization
1024- PROJ_ERR_INVALID_OP_WRONG_SYNTAX =
Other/unspecified error related to coordinate operation initialization
PROJ_ERR_INVALID_OP + 1
- PROJ_ERR_INVALID_OP_MISSING_ARG =
Invalid pipeline structure, missing +proj argument, etc
PROJ_ERR_INVALID_OP + 2
- PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE =
Missing required operation parameter
PROJ_ERR_INVALID_OP + 3
- PROJ_ERR_INVALID_OP_MUTUALLY_EXCLUSIVE_ARGS =
One of the operation parameter has an illegal value
PROJ_ERR_INVALID_OP + 4
- PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID =
Mutually exclusive arguments
PROJ_ERR_INVALID_OP + 5
- PROJ_ERR_COORD_TRANSFM =
Error codes related to transformation on a specific coordinate
2048- PROJ_ERR_COORD_TRANSFM_INVALID_COORD =
Other error related to coordinate transformation
PROJ_ERR_COORD_TRANSFM + 1
- PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN =
For e.g lat > 90deg
PROJ_ERR_COORD_TRANSFM + 2
- PROJ_ERR_COORD_TRANSFM_NO_OPERATION =
Coordinate is outside of the projection domain. e.g approximate mercator with |longitude - lon_0| > 90deg, or iterative convergence method failed
PROJ_ERR_COORD_TRANSFM + 3
- PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID =
No operation found, e.g if no match the required accuracy, or if ballpark transformations were asked to not be used and they would be only such candidate
PROJ_ERR_COORD_TRANSFM + 4
- PROJ_ERR_COORD_TRANSFM_GRID_AT_NODATA =
Point to transform falls outside grid or subgrid
PROJ_ERR_COORD_TRANSFM + 5
- PROJ_ERR_OTHER =
Other type of errors
4096- PROJ_ERR_OTHER_API_MISUSE =
Error related to a misuse of PROJ API
PROJ_ERR_OTHER + 1
- PROJ_ERR_OTHER_NO_INVERSE_OP =
No inverse method available
PROJ_ERR_OTHER + 2
- PROJ_ERR_OTHER_NETWORK_ERROR =
Failure when accessing a network resource
PROJ_ERR_OTHER + 3
Class Method Summary collapse
-
.check_context(context) ⇒ Object
Check the context to see if an error occurred.
- .check_object(pj_object) ⇒ Object
-
.message(context, errno) ⇒ Object
Returns the current error-state of the context.
- .validate_context!(context) ⇒ Object
Class Method Details
.check_context(context) ⇒ Object
Check the context to see if an error occurred. If an error has happened will raise an exception.
36 37 38 39 40 |
# File 'lib/proj/error.rb', line 36 def self.check_context(context) unless context.errno == 0 raise(self, self.(context, context.errno)) end end |
.check_object(pj_object) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/proj/error.rb', line 42 def self.check_object(pj_object) # It would be nice if Proj exposed the proj_context_errno_set method so # we don't need a pj_object context = pj_object.context unless context.errno == 0 = self.(context, context.errno) Api.proj_errno_reset(pj_object) raise(self, ) end end |
.message(context, errno) ⇒ Object
Returns the current error-state of the context. An non-zero error codes indicates an error.
See proj.org/development/reference/functions.html#c.proj_errno_string proj_errno_string
return [String]
61 62 63 64 65 66 67 |
# File 'lib/proj/error.rb', line 61 def self.(context, errno) if Api.method_defined?(:proj_context_errno_string) Api.proj_context_errno_string(context, errno) elsif Api.method_defined?(:proj_errno_string) Api.proj_errno_string(errno) end end |
.validate_context!(context) ⇒ Object
28 29 30 31 32 |
# File 'lib/proj/error.rb', line 28 def self.validate_context!(context) return if context.is_a?(Context) raise(TypeError, "expected Proj::Context, got #{context.class}") end |