ME = MException(identifier, message)
ME = MException(identifier, format, A, ...)
ME = addCause(ME, causeException)
ME = ME.addCause(causeException)
ME = addCorrection(ME, correction)
report = getReport(ME)
report = ME.getReport(type)
exception = MException.last
MException.last('reset')
| Paramètre | Description |
|---|---|
| identifier | une chaine : identifiant d'erreur. |
| message | une chaine de caracteres. |
| format | une chaine utilisee pour formater le message d'erreur. |
| causeException | un objet MException scalaire. |
| correction | un objet nelson.lang.correction. |
| type | 'basic' ou 'extended'. |
| Paramètre | Description |
|---|---|
| ME | un objet MException. |
| report | une chaine : rapport formate de l'exception. |
Tout code Nelson qui detecte une erreur et leve une exception construit un objet MException.
L'identifiant inclut un ou plusieurs champs composants et un champ mnemonique (exemple : 'nelson:matrix:empty').
MException est une classe integree. Elle possede les proprietes en lecture seule identifier, message, cause, stack et Correction.
ME = MException(identifier, format, A, ...) formate le message avec les memes regles que sprintf.
addCause renvoie un nouvel objet MException avec une cause supplementaire.
addCorrection renvoie un nouvel objet MException avec un objet de correction. Les objets de correction Nelson sont dans le paquet nelson.lang.correction.
getReport renvoie un rapport formate de l'exception.
MException.last renvoie la derniere exception non interceptee enregistree par l'evaluateur. MException.last('reset') l'efface.
ME = MException('nelson:identifier', 'your error message.');
throw(ME)
ME = MException('nelson:badIndex', 'Unable to index into array %s.', 'A');
causeException = MException('nelson:badSubscript', 'Index must be positive.');
ME = ME.addCause(causeException)
getReport(ME, 'basic')
ME = MException('nelson:missingArgument', 'Missing argument.');
correction = nelson.lang.correction.AppendArgumentsCorrection('value');
ME = addCorrection(ME, correction)
ME.Correction
| Version | Description |
|---|---|
| 1.0.0 | version initiale |