2,619 matches across 25 files for error
snippet_mode: auto · sorted by relevance
41
42validation_error_definition = {
43▶ "title": "ValidationError",
44 "type": "object",
45 "properties": {
· · ·
50 },
51 "msg": {"title": "Message", "type": "string"},
52▶ "type": {"title": "Error Type", "type": "string"},
53 "input": {"title": "Input"},
54 "ctx": {"title": "Context", "type": "object"},
· · ·
58
59validation_error_response_definition = {
60▶ "title": "HTTPValidationError",
61 "type": "object",
62 "properties": {
· · ·
64 "title": "Detail",
65 "type": "array",
66▶ "items": {"$ref": REF_PREFIX + "ValidationError"},
67 }
68 },
· · ·
73 "2XX": "Success",
74 "3XX": "Redirection",
75▶ "4XX": "Client Error",
76 "5XX": "Server Error",
77 "DEFAULT": "Default Response",
+ 6 more matches in this file
372 ),
373 ] = None,
374▶ auto_error: Annotated[
375 bool,
376 Doc(
· · ·
378 By default, if no HTTP Authorization header is provided, required for
379 OAuth2 authentication, it will automatically cancel the request and
380▶ send the client an error.
381
382 If `auto_error` is set to `False`, when the HTTP Authorization header
· · ·
382▶ If `auto_error` is set to `False`, when the HTTP Authorization header
383 is not available, instead of erroring out, the dependency result will
384 be `None`.
· · ·
383▶ is not available, instead of erroring out, the dependency result will
384 be `None`.
385
· · ·
397 )
398 self.scheme_name = scheme_name or self.__class__.__name__
399▶ self.auto_error = auto_error
400
401 def make_not_authenticated_error(self) -> HTTPException:
+ 9 more matches in this file
14 commit_sha: str
15 run_id: int
16▶ state: Literal["pending", "success", "error"] = "pending"
17
18
· · ·
48 logging.info("No deploy URL available yet")
49 return
50▶ if settings.state == "error":
51 current_commit.create_status(
52 state="error",
· · ·
52▶ state="error",
53 description="Error Deploying Docs",
54 context="deploy-docs",
· · ·
53▶ description="Error Deploying Docs",
54 context="deploy-docs",
55 target_url=run_url,
· · ·
56 )
57▶ logging.info("Error deploying docs")
58 return
59 assert settings.state == "success"
400 self.model = HTTPBaseModel(scheme="digest", description=description)
401 self.scheme_name = scheme_name or self.__class__.__name__
402▶ self.auto_error = auto_error
403
404 async def __call__(self, request: Request) -> HTTPAuthorizationCredentials | None:
· · ·
406 scheme, credentials = get_authorization_scheme_param(authorization)
407 if not (authorization and scheme and credentials):
408▶ if self.auto_error:
409 raise self.make_not_authenticated_error()
410 else:
· · ·
409▶ raise self.make_not_authenticated_error()
410 else:
411 return None
· · ·
412 if scheme.lower() != "digest":
413▶ if self.auto_error:
414 raise self.make_not_authenticated_error()
415 else:
· · ·
414▶ raise self.make_not_authenticated_error()
415 else:
416 return None
122
123 if len(code_include_lines) != len(original_includes):
124▶ raise ValueError(
125 "Number of code include placeholders does not match the number of code includes "
126 "in the original document "
· · ·
221
222 if len(header_permalinks) != len(original_header_permalinks):
223▶ raise ValueError(
224 "Number of headers with permalinks does not match the number in the "
225 "original document "
· · ·
232
233 if header_info["hashes"] != original_header_info["hashes"]:
234▶ raise ValueError(
235 "Header levels do not match between document and original document"
236 f" (found {header_info['hashes']}, expected {original_header_info['hashes']})"
· · ·
321
322 if len(links) != len(original_links):
323▶ raise ValueError(
324 "Number of markdown links does not match the number in the "
325 "original document "
· · ·
445
446 if len(links) != len(original_links):
447▶ raise ValueError(
448 "Number of HTML links does not match the number in the "
449 "original document "
+ 3 more matches in this file
201 ),
202 ] = None,
203▶ auto_error: Annotated[
204 bool,
205 Doc(
· · ·
206 """
207 By default, if the header is not provided, `APIKeyHeader` will
208▶ automatically cancel the request and send the client an error.
209
210 If `auto_error` is set to `False`, when the header is not available,
· · ·
210▶ If `auto_error` is set to `False`, when the header is not available,
211 instead of erroring out, the dependency result will be `None`.
212
· · ·
211▶ instead of erroring out, the dependency result will be `None`.
212
213 This is useful when you want to have optional authentication.
· · ·
225 scheme_name=scheme_name,
226 description=description,
227▶ auto_error=auto_error,
228 )
229
338 return encoder(obj)
339 if is_pydantic_v1_model_instance(obj):
340▶ raise PydanticV1NotSupportedError(
341 "pydantic.v1 models are no longer supported by FastAPI."
342 f" Please update the model {obj!r}."
· · ·
345 data = dict(obj)
346 except Exception as e:
347▶ errors: list[Exception] = []
348 errors.append(e)
349 try:
· · ·
348▶ errors.append(e)
349 try:
350 data = vars(obj)
· · ·
351 except Exception as e:
352▶ errors.append(e)
353 raise ValueError(errors) from e
354 return jsonable_encoder(
· · ·
353▶ raise ValueError(errors) from e
354 return jsonable_encoder(
355 data,
138 raise RuntimeError(response.text)
139 data = response.json()
140▶ if "errors" in data:
141 logging.error(f"Errors in response, after: {after}")
142 logging.error(data["errors"])
· · ·
141▶ logging.error(f"Errors in response, after: {after}")
142 logging.error(data["errors"])
143 logging.error(response.text)
· · ·
142▶ logging.error(data["errors"])
143 logging.error(response.text)
144 raise RuntimeError(response.text)
229 raise RuntimeError(response.text)
230 data = response.json()
231▶ if "errors" in data:
232 logging.error(f"Errors in response, after: {after}, category_id: {category_id}")
233 logging.error(data["errors"])
· · ·
232▶ logging.error(f"Errors in response, after: {after}, category_id: {category_id}")
233 logging.error(data["errors"])
234 logging.error(response.text)
· · ·
233▶ logging.error(data["errors"])
234 logging.error(response.text)
235 raise RuntimeError(response.text)
496
497 Read more in the
498▶ [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).
499 """
500 ),
· · ·
2050 corresponding JSON. But if the data in the object returned is not
2051 valid, that would mean a violation of the contract with the client,
2052▶ so it's an error from the API developer. So, FastAPI will raise an
2053 error and return a 500 error code (Internal Server Error).
2054
· · ·
2053▶ error and return a 500 error code (Internal Server Error).
2054
2055 Read more about it in the
· · ·
2806 corresponding JSON. But if the data in the object returned is not
2807 valid, that would mean a violation of the contract with the client,
2808▶ so it's an error from the API developer. So, FastAPI will raise an
2809 error and return a 500 error code (Internal Server Error).
2810
· · ·
2809▶ error and return a 500 error code (Internal Server Error).
2810
2811 Read more about it in the
+ 4 more matches in this file
447 "type": "json_invalid",
448 "loc": ("body", e.pos),
449▶ "msg": "JSON decode error",
450 "input": {},
451 "ctx": {"error": e.msg},
· · ·
451▶ "ctx": {"error": e.msg},
452 }
453 ],
· · ·
461 except Exception as e:
462 http_error = HTTPException(
463▶ status_code=400, detail="There was an error parsing the body"
464 )
465 raise http_error from e
· · ·
3240 name = route_context.name
3241 if path is not None and not path:
3242▶ raise FastAPIError(
3243 f"Prefix and path cannot be both empty (path operation: {name})"
3244 )
· · ·
3308 corresponding JSON. But if the data in the object returned is not
3309 valid, that would mean a violation of the contract with the client,
3310▶ so it's an error from the API developer. So, FastAPI will raise an
3311 error and return a 500 error code (Internal Server Error).
3312
+ 7 more matches in this file
109 raise RuntimeError(response.text)
110 data = response.json()
111▶ if "errors" in data:
112 logging.error(f"Errors in response, after: {after}")
113 logging.error(data["errors"])
· · ·
112▶ logging.error(f"Errors in response, after: {after}")
113 logging.error(data["errors"])
114 logging.error(response.text)
· · ·
113▶ logging.error(data["errors"])
114 logging.error(response.text)
115 raise RuntimeError(response.text)
213 raise RuntimeError(response.text)
214 data = response.json()
215▶ if "errors" in data:
216 logging.error(f"Errors in response, after: {after}, category_id: {category_id}")
217 logging.error(data["errors"])
· · ·
216▶ logging.error(f"Errors in response, after: {after}, category_id: {category_id}")
217 logging.error(data["errors"])
218 logging.error(response.text)
· · ·
217▶ logging.error(data["errors"])
218 logging.error(response.text)
219 raise RuntimeError(response.text)
107 dependencies=[Depends(dep0)],
108 responses={
109▶ 400: {"description": "Client error level 0"},
110 500: {"description": "Server error level 0"},
111 },
· · ·
110▶ 500: {"description": "Server error level 0"},
111 },
112 default_response_class=ResponseLevel0,
· · ·
119 dependencies=[Depends(dep2)],
120 responses={
121▶ 402: {"description": "Client error level 2"},
122 502: {"description": "Server error level 2"},
123 },
· · ·
122▶ 502: {"description": "Server error level 2"},
123 },
124 default_response_class=ResponseLevel2,
· · ·
132 dependencies=[Depends(dep4)],
133 responses={
134▶ 404: {"description": "Client error level 4"},
135 504: {"description": "Server error level 4"},
136 },
+ 653 more matches in this file
133 def _validate(cls, __input_value: Any, _: Any) -> "UploadFile":
134 if not isinstance(__input_value, StarletteUploadFile):
135▶ raise ValueError(f"Expected UploadFile, received: {type(__input_value)}")
136 return cast(UploadFile, __input_value)
137
15 except RequestValidationError as exc:
16 body = await request.body()
17▶ detail = {"errors": exc.errors(), "body": body.decode()}
18 raise HTTPException(status_code=422, detail=detail)
19
16 except RequestValidationError as exc:
17 body = await request.body()
18▶ detail = {"errors": exc.errors(), "body": body.decode()}
19 raise HTTPException(status_code=422, detail=detail)
20