/***************************************************************************************************
# ERROR GENERATION:
# --------------------------------------------------------------------------------------------------
# SQLAUX scripting library | Author: Sergei Y.Kitáev
# -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/

/*==================================================================================================
# ERROR GENERATION (WITH SOME LOCALIZATION SUPPORT):
# === Usage: ===
# exec [AUX:RaiseError] <Procedure name or null>, <Message>
# exec [AUX:RaiseError] <Procedure name or null>,
#                       <Message in default language>, <Message in main language>
# exec [AUX:RaiseError] <Procedure name or null>,
#                       <Message in default language>, <Message in main language>,
#                       <Message in local language-1>
# exec [AUX:RaiseError] <Procedure name or null>,
#                       <Message in default language>, <Message in main language>,
#                       <Message in local language-1>, <Message in local language-2>
*/
procedure [AUX:RaiseError]
   @ProcedureName    $(dt_String_AUX)  = null,
   @Message          $(dt_Message_AUX),
   @InMainLanguage   $(dt_Message_AUX) = null,
   @XLangText_1      $(dt_Message_AUX) = null,
   @XLangText_2      $(dt_Message_AUX) = null

/*==================================================================================================
# ERROR GENERATION OF INCORRECT CALL OF STORED PROCEDURE:
# === Usage: ===
# exec [AUX:RaiseIncorrectProcedureCall] <Procedure name>, <Cause message>
# exec [AUX:RaiseIncorrectProcedureCall] <Procedure name>,
#                                        <Message in default language>, <Message in main language>
# exec [AUX:RaiseIncorrectProcedureCall] <Procedure name>,
#                                        <Message in default language>, <Message in main language>,
#                                        <Message in local language-1>
# exec [AUX:RaiseIncorrectProcedureCall] <Procedure name>,
#                                        <Message in default language>,
#                                        <Message in main language>,
#                                        <Message in local language-1>,
#                                        <Message in local language-2>
*/
procedure [AUX:RaiseIncorrectProcedureCall]
   @ProcedureName    $(dt_String_AUX),
   @CauseMessage     $(dt_Message_AUX) = null,
   @InMainLanguage   $(dt_Message_AUX) = null,
   @XLangText_1      $(dt_Message_AUX) = null,
   @XLangText_2      $(dt_Message_AUX) = null

/*==================================================================================================
# GENERATION OF NULL-PARAMETER ERROR OF STORED PROCEDURE:
# === Usage: ===
# exec [AUX:RaiseNullParameter] <Procedure name>, <Parameter name>
*/
procedure [AUX:RaiseNullParameter] @ProcedureName $(dt_String_AUX),
                                   @ParameterName $(dt_String_AUX)

/*==================================================================================================
# GENERATION OF DEBUG EXCEPTION ERROR IN STORED PROCEDURE OR SCRIPT:
# === Usage: ===
# exec [AUX:RaiseDebugException] <Procedure name>
# exec [AUX:RaiseDebugException]
*/
procedure [AUX:RaiseDebugException] @ProcedureName $(dt_String_AUX)=null

/*==================================================================================================
# GENERATION OF ROLLBACK EXCEPTION IN STORED PROCEDURE OF SCRIPT (DEBUG ERROR):
# === Usage: ===
# exec [AUX:RaiseRollbackException] <Procedure name>
# exec [AUX:RaiseRollbackException]
*/
procedure [AUX:RaiseRollbackException] @ProcedureName $(dt_String_AUX)=null

/*==================================================================================================
# GENERATION OF UNEXPECTED INTERNAL ERROR IN STORED PROCEDURE OR SCRIPT:
# === Usage: ===
# exec [AUX:RaiseUnexpectedInternalError] <Procedure name>
# exec [AUX:RaiseUnexpectedInternalError] <Procedure name>, <Situation marker>
# exec [AUX:RaiseUnexpectedInternalError]
# exec [AUX:RaiseUnexpectedInternalError] null, <Situation marker>
*/
procedure [AUX:RaiseUnexpectedInternalError]
   @ProcedureName    $(dt_String_AUX) = null,
   @SituationMarker  uniqueidentifier = null

/*==================================================================================================
# GENERATION OF NOT IMPLEMENTED CODE ERROR IN STORED PROCEDURE OR SCRIPT:
# === Usage: ===
# exec [AUX:RaiseNotImplemented]
# exec [AUX:RaiseNotImplemented] <Procedure name>
*/
procedure [AUX:RaiseNotImplemented] @ProcedureName $(dt_String_AUX)=null

/*==================================================================================================
# BLOCKING OF STORED PROCEDURE EXECUTION:
# === Usage: ===
# exec [AUX:RaiseBlockedProcedure] <Procedure name>
*/
procedure [AUX:RaiseBlockedProcedure] @ProcedureName $(dt_String_AUX)

/*==================================================================================================
# GENERATION OF BLOCKED SCRIPT ERROR:
# === Usage: ===
# exec [AUX:RaiseBlockedScript]
*/
procedure [AUX:RaiseBlockedScript]
