End macro or generate run-time error

Syntax

end [errorstring] [flags] [...]

 

Parts

errorstring - run-time error description. Can be string or variable of type QMERROR. If are used more than 2 arguments, errorstring is interpreted as format-string (see str.format).

flags :

0 generate error in caller, unless there is no direct caller. Default.
1 generate error in this function.
2 generate error in caller that is not member function called for this object.
3 generate error in caller of first function that is not in private folder.
4 don't open function even if "Show run-time errors" is checked in Options.

... - values that are inserted into the format-string (errorstring).

 

Remarks

If used without arguments, ends macro.

 

If used with arguments, generates run-time error. Error can be handled with err statement. To set code field of the _error variable, prepend code (numeric value) to errorstring. Alternatively, set code and description fields of _error, and use it instead of errorstring.

 

See also: ret opt end

 

Examples

end
end "file not found"
end "101file %s not found" 0 filevariable

run- "abc"
err
	_error.description + " abc"
	end _error 1