Skip to content

How to handle errors #22

@Shimuuar

Description

@Shimuuar

There are basically two way to deal with invalid input. First is to throw exception on invalid input and second is to return NaN. Both methods have advantages and disadvantages. Currently we use first method.

Throwing exception could be good for controlling NaN spread. Error is raised early and hopefully close to place of origin.Indeed finding out where NaN did appear could be time consuming process.

On the other hand returing NaN gives caller chance to deal with error. This is especially important is code is passed as calllback to C function (e.g. minimization routine). In this case exception means immediate program termination.

So only sensible choice is to give user choice. It's hoever unclear how to do so unobtrusively.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions