0

enter image description here

In this, my queries are,

  • How to handle LibreOffice Exceptions in C#.
  • If could not handle , how to pro-grammatically close this exception or to suppress this exception popup, while excuting console
    • OR any better solution, that my conversion process , should not stop because of unhandle exception caused by Libre Office.
Raghu
  • 136
  • 2
  • 12
  • Use a try catch clause to get a more specific error would be a start – Mighty Badaboom Mar 17 '17 at 12:30
  • If what you're asking is how to handle exceptions, you should take a look at the try...catch statement. – dcg Mar 17 '17 at 12:30
  • What is the line in your C# code where the error occurs -- is it a system call perhaps? – Jim K Mar 17 '17 at 16:14
  • Try Catch block didn't help, as i called libreOffice , via unoconv(3rd party tool), so when exception occurs in libreOffice, it's unhandled by python as well as c# code. – Raghu Mar 28 '17 at 09:43

2 Answers2

1

From the image, it looks like the exception got thrown from storeToUrl() in the code at https://github.com/caolanm/unoconv/blob/master/unoconv.

unoconv is a command line tool, not a library, so it does not seem possible to catch the error with a try/catch block. Perhaps you could capture the process's error stream and parse it to see if an exception occurred.

Instead of using unoconv, it may be better to call storeToUrl() directly in C# using the UNO API, with a try/catch for com.sun.star.io.IOException.

When doing many automated conversions with LibreOffice, it is typically necessary to kill the process whenever it gets stuck: https://github.com/dagwieers/unoconv/issues/352.

Jim K
  • 12,824
  • 2
  • 22
  • 51
0

Firstly, thank you all for your kind help.. :). Finally i resolved.

While bulk file conversion , my c# process, was getting interrupted , because of some exception occurred in LibreOffice process(soffice). so i started killing my c# process and its child processes and also killed soffice. So for next file, fresh soffice is getting created , as i executed unoconv command.

but still, i get the exception popup, but the c# process , keeps continue.. this code helped me

Community
  • 1
  • 1
Raghu
  • 136
  • 2
  • 12