Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

3.2 KB
Raw Blame
// This file is auto-generated by scripts/add-orpc-error-maps.ts
import * as z from 'zod'

const zErrorResponse = /* @__PURE__ */ (() =>
  z.object({
    code: z.string(),
    details: z.record(z.string(), z.unknown()).optional(),
    message: z.string(),
    params: z.string().optional(),
    status: z.int(),
  }))()

const zFileExtensionBlockedError = /* @__PURE__ */ (() =>
  zErrorResponse.and(
    z.object({
      code: z.literal('file_extension_blocked'),
      status: z.literal(400),
    }),
  ))()

const zRemoteFileAccessDeniedError = /* @__PURE__ */ (() =>
  zErrorResponse.and(
    z.object({
      code: z.literal('remote_file_access_denied'),
      status: z.literal(400),
    }),
  ))()

const zRemoteFileInvalidUrlError = /* @__PURE__ */ (() =>
  zErrorResponse.and(
    z.object({
      code: z.literal('remote_file_invalid_url'),
      status: z.literal(400),
    }),
  ))()

const zRemoteFileUrlBlockedError = /* @__PURE__ */ (() =>
  zErrorResponse.and(
    z.object({
      code: z.literal('remote_file_url_blocked'),
      status: z.literal(400),
    }),
  ))()

const zRemoteFileNotFoundError = /* @__PURE__ */ (() =>
  zErrorResponse.and(
    z.object({
      code: z.literal('remote_file_not_found'),
      status: z.literal(404),
    }),
  ))()

const zFileTooLargeError = /* @__PURE__ */ (() =>
  zErrorResponse.and(
    z.object({
      code: z.literal('file_too_large'),
      status: z.literal(413),
    }),
  ))()

const zUnsupportedFileTypeError = /* @__PURE__ */ (() =>
  zErrorResponse.and(
    z.object({
      code: z.literal('unsupported_file_type'),
      status: z.literal(415),
    }),
  ))()

const zRemoteFileInvalidResponseError = /* @__PURE__ */ (() =>
  zErrorResponse.and(
    z.object({
      code: z.literal('remote_file_invalid_response'),
      status: z.literal(502),
    }),
  ))()

const zRemoteFileUnavailableError = /* @__PURE__ */ (() =>
  zErrorResponse.and(
    z.object({
      code: z.literal('remote_file_unavailable'),
      status: z.literal(502),
    }),
  ))()

export const postErrors = {
  file_extension_blocked: { status: 400, data: zFileExtensionBlockedError },
  file_too_large: { status: 413, data: zFileTooLargeError },
  remote_file_access_denied: { status: 400, data: zRemoteFileAccessDeniedError },
  remote_file_invalid_response: { status: 502, data: zRemoteFileInvalidResponseError },
  remote_file_invalid_url: { status: 400, data: zRemoteFileInvalidUrlError },
  remote_file_not_found: { status: 404, data: zRemoteFileNotFoundError },
  remote_file_unavailable: { status: 502, data: zRemoteFileUnavailableError },
  remote_file_url_blocked: { status: 400, data: zRemoteFileUrlBlockedError },
  unsupported_file_type: { status: 415, data: zUnsupportedFileTypeError },
}

export const getErrors = {
  remote_file_access_denied: { status: 400, data: zRemoteFileAccessDeniedError },
  remote_file_invalid_response: { status: 502, data: zRemoteFileInvalidResponseError },
  remote_file_invalid_url: { status: 400, data: zRemoteFileInvalidUrlError },
  remote_file_not_found: { status: 404, data: zRemoteFileNotFoundError },
  remote_file_unavailable: { status: 502, data: zRemoteFileUnavailableError },
  remote_file_url_blocked: { status: 400, data: zRemoteFileUrlBlockedError },
}