Skip to content

Commit

Permalink
[INTERNAL] ESLint: All promise rejection reasons must be an Error
Browse files Browse the repository at this point in the history
eslint-config-google 0.12.0 makes this an error

Also fix async functions resolving to promises rejecting with errors.
Async functions should better directly reject with errors.
  • Loading branch information
RandomByte committed Mar 6, 2019
1 parent a0a22a9 commit e2c2840
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion test/lib/lbt/analyzer/ComponentAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ test("analyze: without manifest", async (t) => {
const mockPool = {
async findResource() {
return {
buffer: async () => Promise.reject()
buffer: async () => {
throw new Error("Some error");
}
};
}
};
Expand Down
4 changes: 3 additions & 1 deletion test/lib/lbt/analyzer/FioriElementsAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ test("analyze: without manifest", async (t) => {
const mockPool = {
async findResource() {
return {
buffer: async () => Promise.reject()
buffer: async () => {
throw new Error("Some error");
}
};
}
};
Expand Down
4 changes: 3 additions & 1 deletion test/lib/lbt/analyzer/SmartTemplateAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ test("analyze: without manifest", async (t) => {
const mockPool = {
async findResource() {
return {
buffer: async () => Promise.reject()
buffer: async () => {
throw new Error("Some error");
}
};
}
};
Expand Down
2 changes: 1 addition & 1 deletion test/lib/lbt/graph/dependencyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ test("dependency with 2 roots", async (t) => {
test("dependency graph with rejecting pool", async (t) => {
const pool = {
async getModuleInfo() {
return Promise.reject("myerror");
throw new Error("myerror");
}
};
const roots = [{
Expand Down
2 changes: 1 addition & 1 deletion test/lib/lbt/resources/ResourcePool.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test("resources", async (t) => {

class ResourcePoolWithRejectingModuleInfo extends ResourcePool {
async getModuleInfo(name) {
return Promise.reject("myerror");
throw new Error("myerror");
}
}

Expand Down

0 comments on commit e2c2840

Please sign in to comment.