question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

5.0 Beta1 will swallow exceptions

See original GitHub issue

I have the following mapper configuration

mapping.ForMember(model => model.Type, e => e.ResolveUsing(dto => GetPropertyType(dto)));

And the implementation of GetPropertyType throws an InvalidArgumentException sometimes:

        private static PropertyAmenityTypeEnum GetPropertyType(PropertyAmenityDto dto)
        {
            if (Enum.IsDefined(typeof (PropertyAmenityTypeEnum), dto.Type))
            {
                return (PropertyAmenityTypeEnum) dto.Type;
            }

            throw new InvalidArgumentException("Invalid amenity type");
        }

I have a test that checks that the mapper is throwing a AutoMapperMappingException on o invalid type that is passing in v4 and failing on the latest beta release.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
lbargaoanucommented, May 20, 2016

Catching nothing is clearly better if you ask me. We’ll just have to see how people react 😃

0reactions
lock[bot]commented, May 7, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release Notes for Flyway Engine
If Flyway encounters a SQL exception while Oracle Spool is set, the error information is now written to the Spool output. Bug fixes....
Read more >
Is it OK to swallow all exceptions except the critical ones in ...
It's okay to swallow specific exceptions in particular cases, but in practice it depends on the use case. I recommend handling exceptions, you ......
Read more >
PHP 5 ChangeLog
Fixed bug #69740 (finally in generator (yield) swallows exception in iteration). Fixed bug #69835 (phpinfo() does not report many Windows SKUs). Fixed bug...
Read more >
Concurrency and exceptions
A catch block that swallows an exception (today) is just about guaranteed—asynchronous exceptions aside—that the IP will soon reach the next ...
Read more >
Do Not Swallow The Exceptions
Throwing away exceptions in your code is just a bad practice and makes it harder to support your application. It may make it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found