<div class="meta" robots="noindex">

</div>

Property

# FolderItem.LastErrorCode

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `IOException</api/exceptions/ioexception>` as a replacement.

</div>

## Description

Contains the error code for the last supported operation on the `FolderItem</api/files/folderitem>`. <span class="title-ref">LastErrorCode</span> will be set for any error.

## Notes

To determine which error code was returned in the <span class="title-ref">LastErrorCode</span> property, you can test it against one of the `FolderItem</api/files/folderitem>` error constants. They are given in the following table:

| Error Code | Constant              | Description                                                                            |
|------------|-----------------------|----------------------------------------------------------------------------------------|
| 0          | NoError               | {Newinversion\|2005r1}}                                                                |
| 100        | DestDoesNotExistError | Destination does not exist. You will get this error only on CopyFileTo and MoveFileTo. |
| 101        | FileNotFound          | The File was not found.                                                                |
| 102        | AccessDenied          | Access was denied.                                                                     |
| 103        | NotEnoughMemory       | You ran out of memory.                                                                 |
| 104        | FileInUse             | The file is in use.                                                                    |
| 105        | InvalidName           | You used an Invalid name.                                                              |

LastErrorCode may also return operating system-specific error codes if the error does not map to one of the above errors. These codes may have values less than 0. For more information about OS-specific codes, check here: \* Windows: [Error Codes at MSDN](http://msdn.microsoft.com/en-us/library/ms681382%28v=VS.85%29.aspx) \* MacOS: Use the macerror command in Terminal to find a description of an error. For example: `macerror -49` which displays: `Mac OS error -49 (opWrErr): file already open with write permission` In addition you can check the older [Mac OS System Error Codes](https://support.apple.com/kb/ht2088), which are can still be useful since <span class="title-ref">LastErrorCode</span> uses older Carbon error codes. \* Linux: [C Error Codes in Linux](http://www.virtsync.com/c-error-codes-include-errno)

## Sample code

This code displays the error code if an error occurred.

``` xojo
Dim f As New FolderItem
f = GetOpenFolderItem("text/plain")
If f.LastErrorCode <> 0 Then 
  MsgBox(Str(f.LastErrorCode))
End If
```

## Compatibility

All project types on all supported operating systems.
