Skip to content

Review use of exceptions #18

Open
Open
@BenBrock

Description

@BenBrock

Scott began a section on exceptions, which I have updated.

Scott also added some notes on errors in the GraphBLAS C API, which I have moved to below:

Notes on C API errors

Informational return values

  • SUCCESS: not necessary with exceptions
  • NO_VALUE: happens in extractElement() method when providing a transparent destination scalar and no stored value. Using grb::out_of_range exception. The justification for changing informational return with exception is the consistency with STL container at() method behaviour.

API errors

  • UNINITIALIZED_OBJECT: not necessary with RAII philosophy
  • NULL_POINTER: not necessary, no pointers used in C++ API
  • INVALID_VALUE:
    • used with incorrect enum values (not necessary in C++)
    • used if a dimension is defined as 0 (like in vector or matrix construction or resize, (do we need this?)
    • duplicate indices during build (do we need this?).
  • INVALID_INDEX: This is specifically for indices that are outside the defined dimensions (for setElement(), extractElement(), removeElement()). Does this overload with NO_VALUE?
  • DOMAIN_MISMATCH: not applicable in C++...if it compiles there is no mismatch.
  • OUTPUT_NOT_EMPTY: was used when trying to build with a container that is not empty....what should C++ do?
  • NOT_IMPLEMENTED: ???

Execution Errors

  • PANIC - do we need this?
  • OUT_OF_MEMORY: using std::bad_alloc... why not grb::bad_alloc? Because allocators not part of GraphBLAS spec.
  • INSUFFICIENT_SPACE: ???
  • INVALID_OBJECT: The requires a discussion of exception quarantees. I.e. what is the state of an output object when an exception is thrown during an operation it was called with? This is also complicated by non-blocking mode which is deferred for now.
  • INDEX_OUT_OF_BOUNDS: grb::out_of_range (This is overloaded use...for two different meanings)
  • EMPTY_OBJECT: (only called in reduce to scalar...does C++ API side step this)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions