Skip to content

Commit 11f3d20

Browse files
Added error handling imports
1 parent d138748 commit 11f3d20

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

PDFTronGo/pdftron.i

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,18 @@
214214
#undef SetPort
215215
%}
216216

217+
// ==============
218+
// ERROR HANDLING
219+
// ==============
220+
// Converts C++ exceptions to Go errors using panic/recovery mechanism.
221+
// All functions now return an error in addition to their return type instead of panicking on exceptions.
222+
223+
// Ensure necessary imports for error handling code
224+
%insert(go_imports) %{
225+
import "errors"
226+
import "fmt"
227+
%}
228+
217229
%include "exception.i"
218230
%exception {
219231
try {
@@ -234,6 +246,10 @@
234246
$result = nil
235247
%}
236248

249+
// ==================
250+
// END ERROR HANDLING
251+
// ==================
252+
237253
/**
238254
* Provides mapping for C++ vectors.
239255
* For example, vector<double> will be called as VectorDouble in GoLang.

0 commit comments

Comments
 (0)