Exception: NSConnector::Errors::NSError

Inherits:
Exception
  • Object
show all
Defined in:
lib/ns_connector/errors.rb

Overview

Parent class to encapsulate all successfully parsed JSON netsuite error responses.

Instance Method Summary collapse

Constructor Details

#initialize(netsuite_error = nil) ⇒ NSError

Returns a new instance of NSError.



9
10
11
# File 'lib/ns_connector/errors.rb', line 9

def initialize netsuite_error=nil
	@netsuite_error = netsuite_error if netsuite_error
end

Instance Method Details

#codeObject

Returns the error code from the JSON returned by netsuite. Something like: “RCRD_DSNT_EXIST”



15
16
17
# File 'lib/ns_connector/errors.rb', line 15

def code
	@netsuite_error['code'] rescue nil
end

#messageObject

Takes the error message straight out of the netsuite response. Usually makes some sense.



21
22
23
# File 'lib/ns_connector/errors.rb', line 21

def message
	@netsuite_error['message'] rescue nil
end