More informative messages when index out of bound

Open
#1,121 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
data

Research direction

Start by tracing the slice-indexing error path for the reported arr.slice(s![a..b, c..d]) example. Add a regression test covering an out-of-bounds slice and use the requested array size, slice argument, and failing axis details as the definition of done.

Written by the indexing model from the issue text.

Description

Hi thanks for the lib! When I made a bug and access index out of bound (e.g. arr.slice(s![a..b, c..d])), I see:

Slice begin 16744 is past end of axis of length 184

I would appreciate it if it could be a bit more informative, such as:

Slice begin 16744 is past end of axis of length 184 (array size: 1234x184; slice arg: 123x16744)

Then, programmers can debug the problem quicker - at least we know which axis goes wrong.

Dominant language
Rust
Stars
4.3k
Forks
391
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-ndarray/ndarray

All issues in rust-ndarray/ndarray

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.