Skip to content

fix: throw errors on overflow in duration integer multiplication#17063

Merged
fdncred merged 1 commit into
nushell:mainfrom
kaathewisegit:duration-overflow
Dec 4, 2025
Merged

fix: throw errors on overflow in duration integer multiplication#17063
fdncred merged 1 commit into
nushell:mainfrom
kaathewisegit:duration-overflow

Conversation

@kaathewisegit
Copy link
Copy Markdown
Contributor

Partially fixes #17062.

This is a small change which adds checks for all potentially overflowing duration/integer operations, in addition to the sum check added in #16594. This doesn't include floating point operations, which might still overflow.

I also took the liberty to move the shared code into a function. It does mean that the span message will no longer have the operation name. If that's not acceptable, I can refactor it to use the operator name.

Release notes summary - What our users need to know

  • Multiplying duration by integers now throws an error on overflow

@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Dec 4, 2025

Thanks

@fdncred fdncred merged commit 9b2e618 into nushell:main Dec 4, 2025
16 checks passed
@github-actions github-actions Bot added this to the v0.110.0 milestone Dec 4, 2025
@fdncred fdncred added A:error-handling How errors in externals/nu code are caught or handled programmatically (see also unhelpful-error) notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes labels Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:error-handling How errors in externals/nu code are caught or handled programmatically (see also unhelpful-error) notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duration arithmetic doesn't error on overflow

2 participants