faustinoaq changed the topic of #amber to: Welcome to Amber Framework community! | https://amberframework.org | Developer happiness, productivity and bare metal performance | GH: https://github.com/amberframework | Docs: https://docs.amberframework.org | Gitter: https://gitter.im/amberframework/amber | IRC Logger: https://irclog.whitequark.org/amber | Amber::Server.start
_whitelogger has joined #amber
_whitelogger has joined #amber
_whitelogger has joined #amber
_whitelogger has joined #amber
<FromGitter> <andrewc910> From the docs about errors: ⏎ ⏎ ```post = Post.new ⏎ post.save ⏎ post.errors[0].to_s.should eq "ERROR: name cannot be null"``` [https://gitter.im/amberframework/amber?at=5e6a5b68a2ccef3232ebf9ad]
<FromGitter> <andrewc910> Any way to do something like `self.errors.add(:my_attribute, "Too short")
<FromGitter> <Blacksmoke16> im not a fan of the `errors` array
<FromGitter> <Blacksmoke16> would be better to just raise an exception or something versus silently failing to save etc
<FromGitter> <andrewc910> They're good for flash messages! lol From the user perspective, they submit a register form, server recieves the response, tries to save, fails, passes error message to flash, the browser refreshes with said error message available. ⏎ ⏎ Going the exception route, user inputs too short of a password, exception is raised, they get a 500 error
<FromGitter> <Blacksmoke16> well the idea would be you would use like a 422 error that contains the failed validations
<FromGitter> <Blacksmoke16> i dont really know anything about server rendered stuff but yea..
<FromGitter> <andrewc910> Wasn't aware of 422. I need to read up on more status codes. ⏎ ⏎ But i don't think a full error is in order. Like if you reset your password but took to long to click the email link, i want to raise an flash message that states 'Token expired, please reset your password again'
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <andrewc910> i have to create an api. Jennifer & Granite handle errors completely differently. Fun.
<FromGitter> <Blacksmoke16> gl
FromGitter has quit [Remote host closed the connection]