We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 536c717 commit 8a86e03Copy full SHA for 8a86e03
docs/index.yml
@@ -26,6 +26,8 @@
26
path: getBoosters.md
27
- name: getServerInfo
28
path: getServerInfo.md
29
+ - name: Error Handling
30
+ path: errorHandling.md
31
# - name: getSkyblockProfiles
32
# path: getSkyblockProfiles.md
33
# - name: getSkyblockMember
docs/methods/errorHandling.md
@@ -0,0 +1,16 @@
1
+# Error Handling
2
+
3
+Example of error handling in `getPlayer` method.
4
5
+```js
6
+const { Errors } = require('hypixel-api-reborn');
7
+// invalid nickname
8
+hypixel.getPlayer('3424242').then((player) => {
9
10
+}).catch((e) => {
11
+ if (e.message === Errors.PLAYER_DOES_NOT_EXIST) {
12
+ console.log(`Player doesn't exist!`);
13
+ // here you can replace default error message with yours.
14
+ }
15
+});
16
+```
0 commit comments