Properly create a custom error.