Exceptions API

Module for all xblock exception classes

exception xblock.exceptions.DisallowedFileError

Raised by open_local_resource() if the requested file is not allowed.

exception xblock.exceptions.FieldDataDeprecationWarning

Warning for use of deprecated _field_data accessor

exception xblock.exceptions.InvalidScopeError(invalid_scope, valid_scopes=None)

Raised to indicated that operating on the supplied scope isn’t allowed by a KeyValueStore

exception xblock.exceptions.JsonHandlerError(status_code, message)

Raised by a function decorated with XBlock.json_handler to indicate that an error response should be returned.

get_response(**kwargs)

Returns a Response object containing this object’s status code and a JSON object containing the key “error” with the value of this object’s error message in the body. Keyword args are passed through to the Response.

exception xblock.exceptions.KeyValueMultiSaveError(saved_field_names)

Raised to indicated an error in saving multiple fields in a KeyValueStore

Create a new KeyValueMultiSaveError

saved_field_names - an iterable of field names (strings) that were successfully saved before the exception occurred

exception xblock.exceptions.NoSuchDefinition

Raised by IdReader.get_block_type() if the definition doesn’t exist.

exception xblock.exceptions.NoSuchHandlerError

Raised to indicate that the requested handler was not found.

exception xblock.exceptions.NoSuchServiceError

Raised to indicate that a requested service was not found.

exception xblock.exceptions.NoSuchUsage

Raised by IdReader.get_definition_id() if the usage doesn’t exist.

exception xblock.exceptions.NoSuchViewError(block, view_name)

Raised to indicate that the view requested was not found.

Create a new NoSuchViewError

Parameters:
  • block – The XBlock without a view
  • view_name – The name of the view that couldn’t be found
exception xblock.exceptions.XBlockNotFoundError(usage_id)

Raised to indicate that an XBlock could not be found with the requested usage_id

exception xblock.exceptions.XBlockSaveError(saved_fields, dirty_fields, message=None)

Raised to indicate an error in saving an XBlock

Create a new XBlockSaveError

saved_fields - a set of fields that were successfully saved before the error occurred dirty_fields - a set of fields that were left dirty after the save