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

Add Logging And Error Handling in Google Drive #120

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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