Skip to content

Commit

Permalink
TypeProviders: Add inner base-exception description (#17251)
Browse files Browse the repository at this point in the history
* TypeProviders: Add inner base-exception description

* Release notes docs updated

* Update src/Compiler/TypedTree/tainted.fs

Thanks @abelbraaksma

Co-authored-by: Abel Braaksma <[email protected]>

* Update docs/release-notes/.FSharp.Compiler.Service/8.0.400.md

Co-authored-by: Abel Braaksma <[email protected]>

* Added @abelbraaksma's suggestion

---------

Co-authored-by: Abel Braaksma <[email protected]>
Co-authored-by: Vlad Zarytovskii <[email protected]>
Co-authored-by: Petr <[email protected]>
  • Loading branch information
4 people authored Jun 27, 2024
1 parent f6e24e8 commit a6f539d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/8.0.400.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* Allow #nowarn to support the FS prefix on error codes to disable warnings ([Issue #17206](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209))
* Allow ParsedHashDirectives to have argument types other than strings ([Issue #17240](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209))
* Parser: better recovery for unfinished patterns ([PR #17231](https://github.com/dotnet/fsharp/pull/17231))
* Expose inner exception information of TypeProviders to help diagnostics in IDE ([PR #17251](https://github.com/dotnet/fsharp/pull/17251))
* Parser: recover on empty match clause ([PR #17233](https://github.com/dotnet/fsharp/pull/17233))

### Changed
Expand Down
5 changes: 3 additions & 2 deletions src/Compiler/TypedTree/tainted.fs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ type internal Tainted<'T> (context: TaintedContext, value: 'T) =
| :? TypeProviderError -> reraise()
| :? AggregateException as ae ->
let errNum,_ = FSComp.SR.etProviderError("", "")
let messages = [for e in ae.InnerExceptions -> e.Message]
let messages = [for e in ae.InnerExceptions -> if isNull e.InnerException then e.Message else (e.Message + ": " + e.GetBaseException().Message)]
raise <| TypeProviderError(errNum, this.TypeProviderDesignation, range, messages)
| e ->
let errNum,_ = FSComp.SR.etProviderError("", "")
raise <| TypeProviderError((errNum, e.Message), this.TypeProviderDesignation, range)
let error = if isNull e.InnerException then e.Message else (e.Message + ": " + e.GetBaseException().Message)
raise <| TypeProviderError((errNum, error), this.TypeProviderDesignation, range)

member _.TypeProvider = Tainted<_>(context, context.TypeProvider)

Expand Down

0 comments on commit a6f539d

Please sign in to comment.