mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 10:14:26 +00:00
Merge ca4e1c8566
into b82af5b826
This commit is contained in:
commit
040f845d7d
3 changed files with 18 additions and 2 deletions
|
@ -5,6 +5,7 @@ import { all_admin_roles } from "@/utils/roles";
|
|||
import { message } from "antd";
|
||||
import { TagNewRequest, TagUpdateRequest, TagDeleteRequest, TagInfoRequest, TagListResponse, TagInfoResponse } from "./tag_management/types";
|
||||
import { Team } from "./key_team_helpers/key_list";
|
||||
import { UiError } from "@/utils/errorUtils";
|
||||
|
||||
const isLocal = process.env.NODE_ENV === "development";
|
||||
export const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
|
||||
|
@ -3263,7 +3264,10 @@ export const teamMemberAddCall = async (
|
|||
const errorData = await response.text();
|
||||
handleError(errorData);
|
||||
console.error("Error response from the server:", errorData);
|
||||
throw new Error("Network response was not ok");
|
||||
if (errorData.includes('already in team')) {
|
||||
throw new UiError("User is already a member of this team")
|
||||
}
|
||||
throw new Error("Failed to add team member");
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
|
|
@ -33,6 +33,7 @@ import MemberModal from "./edit_membership";
|
|||
import UserSearchModal from "@/components/common_components/user_search_modal";
|
||||
import { getModelDisplayName } from "../key_team_helpers/fetch_available_models_team_key";
|
||||
import { isAdminRole } from "@/utils/roles";
|
||||
import { UiError } from "@/utils/errorUtils";
|
||||
|
||||
export interface TeamData {
|
||||
team_id: string;
|
||||
|
@ -131,7 +132,12 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
|
|||
form.resetFields();
|
||||
fetchTeamInfo();
|
||||
} catch (error) {
|
||||
message.error("Failed to add team member");
|
||||
if (error instanceof UiError) {
|
||||
message.error(error.message)
|
||||
} else {
|
||||
message.error("Failed to add team member");
|
||||
}
|
||||
|
||||
console.error("Error adding team member:", error);
|
||||
}
|
||||
};
|
||||
|
|
6
ui/litellm-dashboard/src/utils/errorUtils.ts
Normal file
6
ui/litellm-dashboard/src/utils/errorUtils.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export class UiError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
Object.setPrototypeOf(this, UiError.prototype)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue