Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
Add Logging And Error Handling in Google Drive (#120)
Browse files Browse the repository at this point in the history
* Add Logging And Error Handling in Google Drive

* Clean Up
  • Loading branch information
louismurerwa authored Jun 7, 2024
1 parent 4434caa commit 4fd31df
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 90 deletions.
62 changes: 39 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions packages/apps/google-drive/src/loaders/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { AppNameDefinitions, RateLimiterOpts } from "@ocular/types";
import { RateLimiterService } from "@ocular/ocular";
import { AutoflowAiError, AutoflowAiErrorTypes } from "@ocular/utils";

export default async (container, options) => {
try {
// Register Rate Limiter For Google Drive
if (!options.rate_limiter_opts) {
throw new Error("No options provided for rate limiter");
throw new AutoflowAiError(
AutoflowAiErrorTypes.INVALID_DATA,
"registerRateLimiter: No options provided for rate limiter for Google Drive"
);
}
const rateLimiterOpts: RateLimiterOpts = options.rate_limiter_opts;
const rateLimiterService: RateLimiterService =
Expand All @@ -16,6 +20,10 @@ export default async (container, options) => {
rateLimiterOpts.interval
);
} catch (err) {
console.log(err);
throw new AutoflowAiError(
AutoflowAiErrorTypes.INVALID_DATA,
"registerRateLimiter: Failed to register rate limiter for Google Drive with error: " +
err.message
);
}
};
Loading

0 comments on commit 4fd31df

Please sign in to comment.