Page 1 of 1

More error data for copy and rename functions.

Posted: Sat Dec 10, 2011 1:38 am
by Fangbeast
It would be nice to be able to get more exact error information from Copy and Rename file functions.

At the moment, we have 0 if they fail, nonzero if they don't fail.

Would like some more depth to this if possible.

And maybe other file/filesystem commands as well please?

*EDIT* Never mind, GetLastError_ will do

Re: More error data for copy and rename functions.

Posted: Sun Dec 11, 2011 10:55 am
by HeX0R
A native GetLastError() would be cool!

Re: More error data for copy and rename functions.

Posted: Sun Dec 11, 2011 1:06 pm
by xorc1zt
purebasic native last error would rely on GetLastError() anyway.

Re: More error data for copy and rename functions.

Posted: Mon Dec 12, 2011 7:02 am
by Danilo
xorc1zt wrote:purebasic native last error would rely on GetLastError() anyway.
It's meant to be cross platform, to get internal errors of PureBasic functions.
Most functions just return 0 on error, so you would call the PB error function
to get a code to know what happened.

Code: Select all

#PB_Error_File_NotFound             ; OpenDatabase, ReadFile, LoadFont, LoadImage, OpenLibrary, ...
#PB_Error_Disk_Full                 ; All file write functions (SaveImage, CreatePack, WritePreferenceXXX, WriteData, WriteLong, ...)
#PB_Error_File_NoAccess             ; all file functions, same than the two points above
#PB_Error_FileSystem_NoAccess       ; all file system functions (directory reading etc.)
#PB_Error_Disk_ReadOnly             ; all file write functions when used on a read-only device
#PB_Error_OutOfMemory               ; AllocateMemory, AddElement, CreateImage, CreateSprite, CreateMesh, AddMapElement, CopyArray, OpenWindow, ...
#PB_Error_Network_ConnectionTimeOut ; all network functions, SendMail etc..
#PB_Error_Network_NoConnection      ; all network functions, SendMail etc..
#PB_Error_Network_SendFailed        ; all network send functions
If AllocateMemory or AddElement fail, it is out of memory. But this can also happen with
other functions that allocate memory internally. CreateXXX, OpenXXX, ...

Why did LoadSprite fail? FileNotFound? OutOfMemory? UnsupportedImageFormat (InvalidData)? no access rights to that directory?

Re: More error data for copy and rename functions.

Posted: Mon Dec 12, 2011 10:34 am
by c4s
Danilo is right, this could be a useful feature.