Errors
Custom exceptions for notion-sdk-py.
This module defines the exceptions that can be raised when an error occurs.
APIErrorCode
Bases: str, Enum
Error codes returned in responses from the API.
Source code in notion_client/errors.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
ConflictError = 'conflict_error'
class-attribute
instance-attribute
The transaction could not be completed, potentially due to a data collision. Make sure the parameters are up to date and try again.
GatewayTimeout = 'gateway_timeout'
class-attribute
instance-attribute
The request timed out on the server side.
InternalServerError = 'internal_server_error'
class-attribute
instance-attribute
An unexpected error occurred. Reach out to Notion support.
InvalidBeta = 'invalid_beta'
class-attribute
instance-attribute
The Notion-Beta header is malformed, unknown, duplicated, or references a
stale revision.
InvalidJSON = 'invalid_json'
class-attribute
instance-attribute
The request body could not be decoded as JSON.
InvalidRequest = 'invalid_request'
class-attribute
instance-attribute
This request is not supported.
InvalidRequestURL = 'invalid_request_url'
class-attribute
instance-attribute
The request URL is not valid.
ObjectNotFound = 'object_not_found'
class-attribute
instance-attribute
Given the bearer token used, the resource does not exist. This error can also indicate that the resource has not been shared with owner of the bearer token.
RateLimited = 'rate_limited'
class-attribute
instance-attribute
This request exceeds the number of requests allowed. Slow down and try again.
RestrictedResource = 'restricted_resource'
class-attribute
instance-attribute
Given the bearer token used, the client doesn't have permission to perform this operation.
ServiceOverload = 'service_overload'
class-attribute
instance-attribute
Notion is overloaded. Slow down and try again later.
ServiceUnavailable = 'service_unavailable'
class-attribute
instance-attribute
Notion is unavailable. Try again later. This can occur when the time to respond to a request takes longer than 60 seconds, the maximum request timeout.
Unauthorized = 'unauthorized'
class-attribute
instance-attribute
The bearer token is not valid.
ValidationError = 'validation_error'
class-attribute
instance-attribute
The request body does not match the schema for the expected parameters.
ClientErrorCode
Bases: str, Enum
Error codes generated for client errors.
Source code in notion_client/errors.py
73 74 75 76 77 78 | |
InvalidPathParameterError
Bases: NotionClientErrorBase
Error thrown when a path parameter contains invalid characters such as path traversal sequences (..) that could alter the intended API endpoint.
Source code in notion_client/errors.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
NotionClientErrorBase
Bases: Exception
Base error type for all Notion client errors.
Source code in notion_client/errors.py
85 86 87 88 89 90 91 | |
RequestTimeoutError
Bases: NotionClientErrorBase
Error thrown by the client if a request times out.
Source code in notion_client/errors.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
UnknownHTTPResponseError
Bases: HTTPResponseError
Error thrown if an API call responds with an unknown error code, or does not respond with a properly-formatted error.
Source code in notion_client/errors.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
validate_request_path(path)
Validates that a request path does not contain path traversal sequences. Raises InvalidPathParameterError if the path contains ".." segments, including URL-encoded variants like %2e%2e.
Source code in notion_client/errors.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |