[perl #132909] [LTA?] Failure return from require when load fails
Pretty sure this is a dup of https://github.com/rakudo/rakudo/issues/1515 , you can follow the progress on the issue there. Let us know if your problem is actually different. Closing On 2018-02-25 11:11:55, mt1...@gmail.com wrote: > Hi, > > According to the documentation one should use the following to trap a > failure when loading a module fails using require; > > try require ::('Foo'); > note ::('Foo').Str if ::('Foo') ~~ Failure; > > The problem with this is that it isn't visible what is going wrong. > Using plain > > require ::('Foo'); > > an exception is thrown with a proper error and stack dump. However > when > there are no errors in the module, there are other exceptions thrown > with messages like > > WARNING: unhandled Failure detected in DESTROY. If you meant to ignore > it, you can mark it as handled by > calling .Bool, .so, .not, or .defined methods. The Failure was: > No such symbol 'Foo' > in block at ... (...) line ... > ... > > This seems to me a bug. The only way to handle this properly is the > following > > try { > require ::('Foo'); > > ... > > CATCH { > .note; > } > } > > > > Perl6 version: 2018.01-195-g5ae1ca51f built on MoarVM version > 2018.01-89-ga01cdb449 implementing Perl 6.c. > > Regards, > Marcel
[perl #132909] [LTA?] Failure return from require when load fails
# New Ticket Created by mt1957 # Please include the string: [perl #132909] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=132909 > Hi, According to the documentation one should use the following to trap a failure when loading a module fails using require; try require ::('Foo'); note ::('Foo').Str if ::('Foo') ~~ Failure; The problem with this is that it isn't visible what is going wrong. Using plain require ::('Foo'); an exception is thrown with a proper error and stack dump. However when there are no errors in the module, there are other exceptions thrown with messages like WARNING: unhandled Failure detected in DESTROY. If you meant to ignore it, you can mark it as handled by calling .Bool, .so, .not, or .defined methods. The Failure was: No such symbol 'Foo' in block at ... (...) line ... ... This seems to me a bug. The only way to handle this properly is the following try { require ::('Foo'); ... CATCH { .note; } } Perl6 version: 2018.01-195-g5ae1ca51f built on MoarVM version 2018.01-89-ga01cdb449 implementing Perl 6.c. Regards, Marcel