From 844f5103992238c0c23203286dad16a466e89c97 Mon Sep 17 00:00:00 2001 From: julieng Date: Tue, 3 Aug 2021 08:03:09 +0200 Subject: move *.html to *.md --- .../global_objects/syntaxerror/index.html | 130 --------------------- .../reference/global_objects/syntaxerror/index.md | 130 +++++++++++++++++++++ 2 files changed, 130 insertions(+), 130 deletions(-) delete mode 100644 files/fr/web/javascript/reference/global_objects/syntaxerror/index.html create mode 100644 files/fr/web/javascript/reference/global_objects/syntaxerror/index.md (limited to 'files/fr/web/javascript/reference/global_objects/syntaxerror') diff --git a/files/fr/web/javascript/reference/global_objects/syntaxerror/index.html b/files/fr/web/javascript/reference/global_objects/syntaxerror/index.html deleted file mode 100644 index bddaea8370..0000000000 --- a/files/fr/web/javascript/reference/global_objects/syntaxerror/index.html +++ /dev/null @@ -1,130 +0,0 @@ ---- -title: SyntaxError -slug: Web/JavaScript/Reference/Global_Objects/SyntaxError -tags: - - Error - - JavaScript - - Object - - Reference - - SyntaxError -translation_of: Web/JavaScript/Reference/Global_Objects/SyntaxError -original_slug: Web/JavaScript/Reference/Objets_globaux/SyntaxError ---- -
{{JSRef}}
- -

L'objet SyntaxError représente une erreur qui se produit lors de l'interprétation d'un code dont la syntaxe est invalide.

- -

Description

- -

Une exception SyntaxError est levée lorsque le moteur JavaScript rencontre des entités lexicales invalide ou dans un ordre invalide par rapport à la grammaire du langage.

- -

Syntaxe

- -
new SyntaxError([message[, nomFichier[, numLigne]]])
- -

Paramètres

- -
-
message{{optional_inline}}
-
Une description, lisible par un humain, de l'erreur.
-
nomFichier {{optional_inline}}{{non-standard_inline}}
-
Le nom du fichier contenant le code provoquant l'erreur.
-
numLigne {{optional_inline}}{{non-standard_inline}}
-
Le numéro de la ligne du code qui a provoqué l'exception.
-
- -

Propriétés

- -
-
{{jsxref("SyntaxError.prototype")}}
-
Cette méthode permet d'ajouter des propriétés aux instance de SyntaxError.
-
- -

Méthodes

- -

L'objet global SyntaxError ne contient pas de méthodes directes. En revanche, il hérite de méthodes grâce à sa chaîne de prototypes.

- -

Instances de SyntaxError

- -

Propriétés

- -
{{page('/fr/docs/Web/JavaScript/Reference/Objets_globaux/SyntaxError/prototype', 'Propriétés')}}
- -

Méthodes

- -
{{page('/fr/docs/Web/JavaScript/Reference/Objets_globaux/SyntaxError/prototype', 'Méthodes')}}
- -

Exemples

- -

Intercepter une exception SyntaxError

- -
try {
-  eval('toto truc');
-} catch (e) {
-  console.log(e instanceof SyntaxError); // true
-  console.log(e.message);                // "missing ; before statement"
-  console.log(e.name);                   // "SyntaxError"
-  console.log(e.fileName);               // "Scratchpad/1"
-  console.log(e.lineNumber);             // 1
-  console.log(e.columnNumber);           // 4
-  console.log(e.stack);                  // "@Scratchpad/1:2:3\n"
-}
-
- -

Créer une exception SyntaxError

- -
try {
-  throw new SyntaxError('Coucou', 'unFichier.js', 10);
-} catch (e) {
-  console.log(e instanceof SyntaxError); // true
-  console.log(e.message);                // "Coucou"
-  console.log(e.name);                   // "SyntaxError"
-  console.log(e.fileName);               // "unFichier.js"
-  console.log(e.lineNumber);             // 10
-  console.log(e.columnNumber);           // 0
-  console.log(e.stack);                  // "@Scratchpad/2:11:9\n"
-}
-
- -

Spécifications

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpécificationStatutCommentaires
{{SpecName('ES3')}}{{Spec2('ES3')}}Définition initiale.
{{SpecName('ES5.1', '#sec-15.11.6.4', 'SyntaxError')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-native-error-types-used-in-this-standard-syntaxerror', 'SyntaxError')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-native-error-types-used-in-this-standard-syntaxerror', 'SyntaxError')}}{{Spec2('ESDraft')}} 
- -

Compatibilité des navigateurs

- -

{{Compat("javascript.builtins.SyntaxError")}}

- -

Voir aussi

- - diff --git a/files/fr/web/javascript/reference/global_objects/syntaxerror/index.md b/files/fr/web/javascript/reference/global_objects/syntaxerror/index.md new file mode 100644 index 0000000000..bddaea8370 --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/syntaxerror/index.md @@ -0,0 +1,130 @@ +--- +title: SyntaxError +slug: Web/JavaScript/Reference/Global_Objects/SyntaxError +tags: + - Error + - JavaScript + - Object + - Reference + - SyntaxError +translation_of: Web/JavaScript/Reference/Global_Objects/SyntaxError +original_slug: Web/JavaScript/Reference/Objets_globaux/SyntaxError +--- +
{{JSRef}}
+ +

L'objet SyntaxError représente une erreur qui se produit lors de l'interprétation d'un code dont la syntaxe est invalide.

+ +

Description

+ +

Une exception SyntaxError est levée lorsque le moteur JavaScript rencontre des entités lexicales invalide ou dans un ordre invalide par rapport à la grammaire du langage.

+ +

Syntaxe

+ +
new SyntaxError([message[, nomFichier[, numLigne]]])
+ +

Paramètres

+ +
+
message{{optional_inline}}
+
Une description, lisible par un humain, de l'erreur.
+
nomFichier {{optional_inline}}{{non-standard_inline}}
+
Le nom du fichier contenant le code provoquant l'erreur.
+
numLigne {{optional_inline}}{{non-standard_inline}}
+
Le numéro de la ligne du code qui a provoqué l'exception.
+
+ +

Propriétés

+ +
+
{{jsxref("SyntaxError.prototype")}}
+
Cette méthode permet d'ajouter des propriétés aux instance de SyntaxError.
+
+ +

Méthodes

+ +

L'objet global SyntaxError ne contient pas de méthodes directes. En revanche, il hérite de méthodes grâce à sa chaîne de prototypes.

+ +

Instances de SyntaxError

+ +

Propriétés

+ +
{{page('/fr/docs/Web/JavaScript/Reference/Objets_globaux/SyntaxError/prototype', 'Propriétés')}}
+ +

Méthodes

+ +
{{page('/fr/docs/Web/JavaScript/Reference/Objets_globaux/SyntaxError/prototype', 'Méthodes')}}
+ +

Exemples

+ +

Intercepter une exception SyntaxError

+ +
try {
+  eval('toto truc');
+} catch (e) {
+  console.log(e instanceof SyntaxError); // true
+  console.log(e.message);                // "missing ; before statement"
+  console.log(e.name);                   // "SyntaxError"
+  console.log(e.fileName);               // "Scratchpad/1"
+  console.log(e.lineNumber);             // 1
+  console.log(e.columnNumber);           // 4
+  console.log(e.stack);                  // "@Scratchpad/1:2:3\n"
+}
+
+ +

Créer une exception SyntaxError

+ +
try {
+  throw new SyntaxError('Coucou', 'unFichier.js', 10);
+} catch (e) {
+  console.log(e instanceof SyntaxError); // true
+  console.log(e.message);                // "Coucou"
+  console.log(e.name);                   // "SyntaxError"
+  console.log(e.fileName);               // "unFichier.js"
+  console.log(e.lineNumber);             // 10
+  console.log(e.columnNumber);           // 0
+  console.log(e.stack);                  // "@Scratchpad/2:11:9\n"
+}
+
+ +

Spécifications

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpécificationStatutCommentaires
{{SpecName('ES3')}}{{Spec2('ES3')}}Définition initiale.
{{SpecName('ES5.1', '#sec-15.11.6.4', 'SyntaxError')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-native-error-types-used-in-this-standard-syntaxerror', 'SyntaxError')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-native-error-types-used-in-this-standard-syntaxerror', 'SyntaxError')}}{{Spec2('ESDraft')}} 
+ +

Compatibilité des navigateurs

+ +

{{Compat("javascript.builtins.SyntaxError")}}

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf