AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 12.12.2021, 11:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
dynamicsaxinsight: AX 2012: Handling CLR exceptions
Источник: https://dynamicsaxinsight.wordpress....lr-exceptions/
==============

Purpose:

The purpose of this post is to demonstrate how can we effectively handle CLR exceptions.

Application:

Dynamics AX 2012

Business requirement:

To report CLR inner exception.

Solution:

Please find the code below to get the inner CLR exception.

Code

private void getFiles(){ System.String[] files; System.Collections.IEnumerator enumerator; str file; ; try { fileSet = new Set(Types::Container); files = System.IO.Directory::GetFiles(filePath, '*.csv'); enumerator = files.GetEnumerator(); while (enumerator.MoveNext()) { file = enumerator.get_Current(); fileSet.add([file]); } } catch (Exception::Internal) { this.processCLRErrorException(); } catch (Exception::CLRError) { this.processCLRErrorException(); }}
private void processCLRErrorException(boolean _throw = true){ CLRObject exc; CLRObject innerExc; CLRObject clrExcMessage; str strError; ; exc = CLRInterop::getLastException(); if (exc) { innerExc = exc.get_InnerException(); clrExcMessage = exc.get_Message(); while (innerExc != null) { innerExc = innerExc.get_InnerException(); clrExcMessage = innerExc.get_Message(); } strError = CLRInterop::getAnyTypeForObject(clrExcMessage); error(strError); if (_throw) { throw error("Update has been cancelled"); } }}



Источник: https://dynamicsaxinsight.wordpress....lr-exceptions/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
dynamicsaxse: November 2017 Release – Dynamics AX 2012 R3 Blog bot DAX Blogs 0 08.12.2017 10:51
dynamicsaxse: February release – Dynamics AX 2012 R3 Blog bot DAX Blogs 0 02.03.2017 01:11
dynamics-coe: Microsoft Dynamics AX 2012 Reporting Services – Integrated with SharePoint Farm Blog bot DAX Blogs 0 21.11.2014 13:11
emeadaxsupport: AX Content: Make Microsoft Dynamics AX 2012 yours! Blog bot DAX Blogs 0 01.10.2013 00:12
dynamics-ax: Modeling the world, with Microsoft Dynamics AX 2012 Blog bot DAX Blogs 0 25.01.2011 09:11

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 13:34.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.