# Generate a program error with a custom program error number

**URL:** <https://tech-community.robotics.abb.com/t/generate-a-program-error-with-a-custom-program-error-number/11321>\
**Category:** RobotStudio\
**Tags:** alarm, errwrite, error\
**Created:** [January 9, 2024, 2:52pm UTC](https://tech-community.robotics.abb.com/t/generate-a-program-error-with-a-custom-program-error-number/11321 "2024-01-09T14:52:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dragolollo](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dragolollo](https://tech-community.robotics.abb.com/u/dragolollo)\
**Post date:** [January 9, 2024, 2:52pm UTC](https://tech-community.robotics.abb.com/t/generate-a-program-error-with-a-custom-program-error-number/11321/1 "2024-01-09T14:52:11Z")

</div>

Hello,

The instruction “ErrWrite” is used to generate and display an error message on the teach pendant and, in case of a program error, the error number is 80001.  
Is it possible to define a custom error number?  
Thank you

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [January 9, 2024, 3:36pm UTC](https://tech-community.robotics.abb.com/t/generate-a-program-error-with-a-custom-program-error-number/11321/2 "2024-01-09T15:36:58Z")

</div>

I think that you might use BookErrNo to first RAISE the error, then use ErrWrite to write to the log and/or pendant. I think that the only real significance for the 80001 is that it has it’s own error domain then.  
Other than that, a programmer can declare their own error numbers, just like any pre-defined data, and Raise an error using that number.

---

<div class="post-metadata">

**Author:** ![dragolollo](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dragolollo](https://tech-community.robotics.abb.com/u/dragolollo)\
**Post date:** [January 10, 2024, 9:13am UTC](https://tech-community.robotics.abb.com/t/generate-a-program-error-with-a-custom-program-error-number/11321/3 "2024-01-10T09:13:17Z")

</div>

I think the way is to use ErrLog.  
It seems like if you use ErrWrite the only possible error number is 80001and if you use ErrRaise you can define your own error number but it only generates warnings.
