59 Matching Annotations
  1. Jun 2025
  2. Aug 2023
  3. Jul 2023
  4. Nov 2022
  5. Sep 2022
  6. Jan 2022
  7. Apr 2021
  8. Mar 2021
  9. Feb 2021
    1. So, the sad conclusion is: all problems must be resolved individually depending on a specific usage context. There’s no silver bullet to resolve all ZeroDivisionErrors once and for all. And again, I am not even covering complex IO flows with retry policies and expotential timeouts.
    1. Inside the interaction, we could use #find instead of #find_by_id. That way we wouldn't need the #find_account! helper method in the controller because the error would bubble all the way up. However, you should try to avoid raising errors from interactions. If you do, you'll have to deal with raised exceptions as well as the validity of the outcome.

      What they're referring to:

      Account.find('invalid') will raise an error but Account.find_by(id: 'invalid') will not.

  10. Dec 2020
  11. Nov 2020
  12. Sep 2020
  13. Jul 2020
    1. JSON parsing is always pain in ass. If the input is not as expected it throws an error and crashes what you are doing. You can use the following tiny function to safely parse your input. It always turns an object even if the input is not valid or is already an object which is better for most cases.

      It would be nicer if the parse method provided an option to do it safely and always fall back to returning an object instead of raising exception if it couldn't parse the input.

  14. May 2020
  15. developer.mozilla.org developer.mozilla.org
  16. Apr 2020
  17. Mar 2020
  18. Dec 2019
  19. Mar 2019