error
You might be looking for the "Error" function, which has the same name as this function.
Example
Throwing an custom error that doesn't normally happen.
Output: [my_addon] addons/my_addon/lua/autorun/my_code.lua:1: Because I wanted!
1. error - [C]:-1
2. unknown - addons/my_addon/lua/autorun/my_code.lua:1
Example
Shows what a different level errors look like.
Output: [my_addon] It isn't important
1. error - [C]:-1
2. unknown - addons/my_addon/lua/autorun/my_code.lua:1
[my_addon] addons/my_addon/lua/autorun/my_code.lua:1: I'M VERY IMPORTANT!!!
1. error - [C]:-1
2. unknown - addons/my_addon/lua/autorun/my_code.lua:1