Skip to content

Commit

Permalink
fix: show error on failure while getting distinct column values
Browse files Browse the repository at this point in the history
  • Loading branch information
saravmajestic committed Dec 23, 2024
1 parent 7111c9e commit ee2c6cd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/manifest/dbtProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ export class DBTProject implements Disposable {
error,
{ column, model },
);
throw error;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/webview_provider/altimateWebviewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class AltimateWebviewProvider implements WebviewViewProvider {
this.sendResponseToWebview({
command: "response",
syncRequestId,
status: true,
data: response,
});
} catch (error) {
Expand All @@ -154,6 +155,7 @@ export class AltimateWebviewProvider implements WebviewViewProvider {
command: "response",
syncRequestId,
error: message,
status: false,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { LoadingButton, OptionType, Select, Stack } from "@uicore";
import { useEffect, useState } from "react";
import { Control, Controller, UseFormSetValue } from "react-hook-form";
import { SaveRequest } from "../types";
import { panelLogger } from "@modules/logger";

interface Props {
control: Control<SaveRequest, unknown>;
Expand All @@ -24,23 +25,28 @@ const AcceptedValues = ({
const [isLoading, setIsLoading] = useState(false);
const getDistinctColumnValues = async () => {
setIsLoading(true);
const result = (await executeRequestInSync("getDistinctColumnValues", {
model: currentDocsData?.name,
column,
})) as string[] | undefined;
setIsLoading(false);
try {
const result = (await executeRequestInSync("getDistinctColumnValues", {
model: currentDocsData?.name,
column,
})) as string[] | undefined;

if (result?.length && values?.length) {
const items = ["Yes, overwrite", "Cancel"];
const response = await executeRequestInSync("showInformationMessage", {
infoMessage: "Overwrite the existing values?",
items,
});
if (response !== items[0]) {
return;
if (result?.length && values?.length) {
const items = ["Yes, overwrite", "Cancel"];
const response = await executeRequestInSync("showInformationMessage", {
infoMessage: "Overwrite the existing values?",
items,
});
if (response !== items[0]) {
return;
}
}
setValue("accepted_values", result);
} catch (e) {
panelLogger.error("Unable to get distinct values", e);
} finally {
setIsLoading(false);
}
setValue("accepted_values", result);
};

useEffect(() => {
Expand Down

0 comments on commit ee2c6cd

Please sign in to comment.