# Throw Error.reject equivalent

**URL:** <https://forum.dfinity.org/t/throw-error-reject-equivalent/16076>\
**Category:** Rust\
**Created:** [October 22, 2022, 1:10pm UTC](https://forum.dfinity.org/t/throw-error-reject-equivalent/16076 "2022-10-22T13:10:55Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [October 22, 2022, 2:20pm UTC](https://forum.dfinity.org/t/throw-error-reject-equivalent/16076/6 "2022-10-22T14:20:43Z")

</div>

> [@paulyoung](#):
>
> ic\_cdk::api::trap

Ah nice, will do that!

* * *

Notes:

- I found this [thread](https://forum.dfinity.org/t/ic-cdk-trap-equivalent-in-motoko/7101) and this [thread](https://forum.dfinity.org/t/can-we-return-error-and-trap/13527) about trap

- there is also a `call::error` according this [thread](https://forum.dfinity.org/t/how-to-trigger-a-canister-reject-code-using-ic-cdk-reject/14060)

In my case, the way I coded the functions - for good and bad - both probably do the job.

---

_[View the full topic](https://forum.dfinity.org/t/throw-error-reject-equivalent/16076)._
