Arbortext Command Language > Callbacks > doc_add_callback > protect Callback Type
  
protect Callback Type
Function prototype:
function funcname (doc, opCode, errorCode)
protect is called when an operation is about to fail because of protection. The callback function may tell Arbortext Editor to perform the operation regardless. Currently, this callback is only called when delete operations fail due to a read-only protection error.
Arguments:
doc — The identifier of the document in which the operation is being attempted.
opCode — A code describing the operation. Currently this value is always 1 for a delete.
errorCode — The protection error code. Currently it may be one of the following values:
2 — The document is read-only.
6 — The document object is read-only.
9 — The file entity or XML inclusion is read-only.
12 — The location in the document is read-only.
Return arguments are:
0 — Proceed and let the operation fail due to the protection error.
-1 — Ignore the protection error and let the operation continue.