If you give the gem invalid data the gem throws an error, for instance:
Fortnox::API::Customer.new(customer_number: nil)
# => Fortnox::API::AttributeError: [Fortnox::API::Model::Order.new] nil (NilClass) has invalid type for :customer_number violates constraints (type?(String, nil) failed)>`
It does help us developers, but it is not much for the end user. We should try to improve this. Maybe there is some new feature in the Dry library that can help us out?
A simple improvement would be to add an attribute method to the Fortnox::API::AttributeError (or whatever error we are talking about) which returns the invalid attribute. Then we can at least tell the end user what attribute is invalid.
If you give the gem invalid data the gem throws an error, for instance:
It does help us developers, but it is not much for the end user. We should try to improve this. Maybe there is some new feature in the
Dry
library that can help us out?A simple improvement would be to add an
attribute
method to theFortnox::API::AttributeError
(or whatever error we are talking about) which returns the invalid attribute. Then we can at least tell the end user what attribute is invalid.