Skip to content

Commit

Permalink
fix(core): throw error for unknown cases
Browse files Browse the repository at this point in the history
  • Loading branch information
hckhanh committed Dec 12, 2020
1 parent 3d01a74 commit 1ab9674
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function convertTimeCalculations(query: string): string {
return `TIMESTAMP_${operator}(CURRENT_TIMESTAMP(), INTERVAL ${matches[3]} DAY)`;
}

return substring;
throw new Error(`Cannot parse "${substring}"`);
}
);

Expand All @@ -67,7 +67,8 @@ function removeQuotesForNumber(query: string): string {
if (matches) {
return matches[1];
}
return substring;

throw new Error(`Cannot parse "${substring}"`);
});
}

Expand All @@ -79,7 +80,8 @@ function convertDatePartFunction(query: string): string {
if (matches) {
return `EXTRACT(${matches[1].toUpperCase()} FROM ${matches[2]})`;
}
return substring;

throw new Error(`Cannot parse "${substring}"`);
}
);
}
Expand All @@ -92,7 +94,8 @@ function castElseCaseToString(query: string): string {
if (matches) {
return `ELSE CAST(${matches[1]} AS STRING)`;
}
return substring;

throw new Error(`Cannot parse "${substring}"`);
}
);
}
Expand Down

0 comments on commit 1ab9674

Please sign in to comment.