class Proj::Error
Represents error thrown by Proj
Constants
- PROJ_ERR_COORD_TRANSFM
Error
codes related to transformation on a specific coordinate- PROJ_ERR_COORD_TRANSFM_GRID_AT_NODATA
- PROJ_ERR_COORD_TRANSFM_INVALID_COORD
- PROJ_ERR_COORD_TRANSFM_NO_OPERATION
- PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID
- PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN
- PROJ_ERR_INVALID_OP
Error
codes typically related to coordinate operation initialization- PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID
- PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE
- PROJ_ERR_INVALID_OP_MISSING_ARG
- PROJ_ERR_INVALID_OP_MUTUALLY_EXCLUSIVE_ARGS
- PROJ_ERR_INVALID_OP_WRONG_SYNTAX
- PROJ_ERR_OTHER
Other type of errors
- PROJ_ERR_OTHER_API_MISUSE
- PROJ_ERR_OTHER_NETWORK_ERROR
- PROJ_ERR_OTHER_NO_INVERSE_OP
Public Class Methods
category(errno)
click to toggle source
Converts an errno to a error category
# File lib/proj/error.rb, line 65 def self.category(errno) self.constants.find do |constant| self.const_get(constant) == errno end end
check_context(context)
click to toggle source
Check the context to see if an error occurred. If an error has happened will raise an exception.
# File lib/proj/error.rb, line 30 def self.check_context(context) unless context.errno == 0 # raise(self, "#{self.category(context.errno)}: #{self.message(context)}") raise(self, self.message(context, context.errno)) end end
check_object(pj_object)
click to toggle source
# File lib/proj/error.rb, line 37 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 message = self.message(context, context.errno) Api.proj_errno_reset(pj_object) raise(self, message) end end
message(context, errno)
click to toggle source
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
@param context [Context] The context the error occurred in @param errno [Integer] The error number
return [String]
# File lib/proj/error.rb, line 56 def self.message(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