# dmd.canthrow

Perform checks for `nothrow`.

Specification: Nothrow Functions

#### Authors

Walter Bright

#### License

Boost License 1.0

Source: canthrow.d

Documentation: https://dlang.org/phobos/dmd_canthrow.html

Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/canthrow.d

- `CT`

  #### Declaration

  `enum `CT`: BE;`

  Status indicating what kind of throwable might be caused by an expression.

  #### Discussion

  This is a subset of `BE` restricted to the values actually used by `canThrow`.

  - `none`

    #### Declaration

    ``none``

    Never throws an `Exception` or `Throwable`

  - `exception`

    #### Declaration

    ``exception``

    Might throw an `Exception`

- `canThrow`

  #### Declaration

  `CT `canThrow`(Expression `e`, FuncDeclaration `func`, ErrorSink `eSink`);`

  If ``eSink`` is not `null`, generate an error if ``e`` throws

  #### Parameters

  `Expression `e`` | expression to check for throwing
  `FuncDeclaration `func`` | function
  `ErrorSink `eSink`` | if !`null`, then send error messages to `eSink`

  #### Return Value

  `CT.exception` or `CT.error` if the expression may throw exceptions.