NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Thys on May 20, 2018, 10:48:17 PM
-
Hi,
Below is a portion of code in the DeleteRecord routine. You will notice that the first call p_web.AddServiceError uses ERRORCODE and ERROR to indicate the reason of the delete error. But it seems as if the errorcode has been reset before this call, resulting in errorcode 0 to be returned here ("ERRORDESCRIPTION": "Error occured Deleting the record 0").
So it's important to catch the error before other calls are made. Also, if an error occurs using SQL then ERRORCODE only returns 90 (FileSystemError) which doesn't say much about the real error. You should use FILEERRORCODE to get the real reason. This type of statement helps a lot to get the correct description:
choose (errorcode () = 90, fileerror (), error ())
Thanks,
Thys
do QueueToFile:RequiredAttribute
If p_web.GetFile(RequiredAttribute,REQ:RequiredAttribute_PK) = 0
idString = 'REQ:GUID = ' & REQ:GUID
If p_web.sqlsync then p_web.SqlWait(p_web.SqlName).
err = p_web.DeleteFile(RequiredAttribute)
If p_web.sqlsync then p_web.SqlRelease(p_web.SqlName).
if Err = 0
p_web.AddServiceResult('Delete','RequiredAttribute',idString,'success')
Else
p_web.AddServiceError(Err,'dbRequiredAttribute', p_web.RecordIdentifier(RequiredAttribute), 'Error occured Deleting the record ' & errorcode() & ' '& error(), '')
End
Else
p_web.AddServiceError(Error:RecordNotFound,'dbRequiredAttribute', p_web.RecordIdentifier(RequiredAttribute), 'Record not found when attempting to do a Delete', '')
End
-
I've tweaked this for the 10.22 build to use the ErrorClass in ABC apps.
you can also use
p_web.Error(), p_web.ErrorCode(), p_web.FileError() and p_web.FileErrorCode() after calls to
p_web.OpenFile(), p_web.AddFile(), p_web.UpdateFile(), p_web.GetFile() and p_web.DeleteFile().
If you are using ABC file methods directly, like Access:Table.Insert and so on, then you can do a
p_web.SetErrors()
after the call, and then
p_web.Error(), p_web.ErrorCode(), p_web.FileError() and p_web.FileErrorCode()
will also return the various error values.
cheers
Bruce
-
Hi Bruce.
I'm using 10.33 now. When trying to update a record, even with the Err returning 1, the values of p_web.Error (), p_web.ErrorCode () and p_web.FileErrorCode () are all blank or 0. When I replace the p_web.UpdateFile () statement with a simple PUT, not errors occur - so it looks like the .UpdateFile method may be doing something more than just a PUT.
Thys