# File attachment - out of disk space error - how to handle?

**URL:** <https://www.dynamicsuser.net/t/file-attachment-out-of-disk-space-error-how-to-handle/65030>\
**Category:** Developer Forum\
**Created:** [February 14, 2018, 6:42pm UTC](https://www.dynamicsuser.net/t/file-attachment-out-of-disk-space-error-how-to-handle/65030 "2018-02-14T18:42:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DotNet](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@DotNet](https://www.dynamicsuser.net/u/DotNet)\
**Post date:** [February 14, 2018, 6:42pm UTC](https://www.dynamicsuser.net/t/file-attachment-out-of-disk-space-error-how-to-handle/65030/1 "2018-02-14T18:42:12Z")

</div>

Hello,

We are on DAX 2012 CU3. Our file attachment DAX custom service can’t attach the files when the disk ran out of the space on the server. I am wondering is there a way to handle the error that returns when the server ran out of disk space or something like ERROR\_DISK\_FULL?

When I am trying to put the code the for exception handling I only see the below error handling options available. Any inputs how it can be handled?

![ExceptionHandling1.png](https://us1.discourse-cdn.com/flex023/uploads/dugusers/original/2X/9/9519d6c336a844b33ca0ab369b611b172e06f45c.png)

![ExceptionHandling2.png](https://us1.discourse-cdn.com/flex023/uploads/dugusers/original/2X/7/762272367a5607ff5809a67badfd394988798e7c.png)

Thanks!

---

<div class="post-metadata">

**Author:** ![MartinDrab](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@MartinDrab](https://www.dynamicsuser.net/u/MartinDrab)\
**Post date:** [February 14, 2018, 9:38pm UTC](https://www.dynamicsuser.net/t/file-attachment-out-of-disk-space-error-how-to-handle/65030/2 "2018-02-14T21:38:48Z")

</div>

It’s a tricky topic. But before going into details, consider if you really need to know whether there is no disk space or it failed for another reason (e.g. a HW failure or a read-only location). If you react in the same way, investing time to distinguishing them wouldn’t make much sense. Shouldn’t you rather start monitoring disk space on your servers to avoid the problem in the first place?

X++ exception don’t contain any additional metadata, you just get a value of that enum (= a number) and that’s it. All you can do is looking at the last message in infolog.

You can achieve more with .NET exceptions, but in this case you’ll get just a generic IOException. If you want to find the particular reason such as ERROR\_DISK\_FULL, you would have to dig into its HResults, which is a bit tricky in .NET framework lower than 4.5 (but doable).

Maybe it’s possible to get HResults even for errors from AX kernel, but I’ve never tried it.
