Skip to content

Commit 887cba6

Browse files
author
Lucien Le Roux
committed
Ignore 'No ACLs' error
1 parent 5ec184a commit 887cba6

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

endpoints.js

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* This is the list of every endpoint exposed by the Blih API.
3+
*
4+
* Each of them is defined by the following properties:
5+
* - name: name of the endpoint
6+
* - method: method the endpoint accepts
7+
* - path: path to endpoint
8+
*
9+
* Additionnally, optional properties may affect data sent or received
10+
* when requesting the API :
11+
* - data: if the endpoint accepts data
12+
* - transform: to transform received data
13+
* - onError: data to receive instead of an error
14+
*/
15+
116
module.exports = [
217
/*
318
* Repositories
@@ -21,7 +36,8 @@ module.exports = [
2136
name: r,
2237
url: data.repositories[r].url,
2338
uuid: data.repositories[r].uuid
24-
}))
39+
})),
40+
onError: _ => []
2541
}, {
2642
name: 'repositoryInfo',
2743
method: 'GET',
@@ -48,7 +64,8 @@ module.exports = [
4864
.map(c => ({
4965
name: c,
5066
rights: data[c]
51-
}))
67+
})),
68+
onError: _ => []
5269
/*
5370
* SSH keys
5471
*/
@@ -70,7 +87,8 @@ module.exports = [
7087
.map(k => ({
7188
name: k,
7289
data: data[k]
73-
}))
90+
})),
91+
onError: _ => []
7492
/*
7593
* Misc
7694
*/

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module.exports = class Blih {
3838
json: body
3939
}, (err, response, body) => {
4040
if (err || body.error) {
41-
reject(err || body.error);
41+
reject(err || endpoint.onError ? endpoint.onError() : body.error);
4242
} else {
4343
resolve(endpoint.transform ? endpoint.transform(body) : body);
4444
}

0 commit comments

Comments
 (0)