Ruby’s New Exception Keyword Arguments

`exception: false` and `exception: true`

Shannon Skipper
May 15, 2018 · 3 min read

Heads up, we’ve moved! If you’d like to continue keeping up with the latest technical content from Square please visit us at our new home https://developer.squareup.com/blog

Background

Integer('nope') rescue nil
#=> nil

Exception False with Numeric Conversion

Image for post
Image for post

Exception True with System

system 'nope'
#=> nil
system 'nope', exception: true
#!> Errno::ENOENT: No such file or directory - nope

Conclusion

Image for post
Image for post
The Ruby logo is Copyright © 2006, Yukihiro Matsumoto, distributed under CC BY-SA 2.5.

Square Corner Blog

Buying and selling sound like simple things - and they…

Thanks to Stephanie Wilkinson

Shannon Skipper

Written by

Square Corner Blog

Buying and selling sound like simple things - and they should be. Somewhere along the way, they got complicated. At Square, we're working hard to make commerce easy for everyone.

Shannon Skipper

Written by

Square Corner Blog

Buying and selling sound like simple things - and they should be. Somewhere along the way, they got complicated. At Square, we're working hard to make commerce easy for everyone.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store