Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/Compiler/TypedTree/tainted.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@ type internal TypeProviderError
new((errNum, msg: RichText), tpDesignation,m) =
TypeProviderError(errNum, tpDesignation, m, [msg])

new((errNum, msg: string), tpDesignation, m) =
TypeProviderError(errNum, tpDesignation, m, [RichText.mkText msg])

new(errNum, tpDesignation, m, messages: seq<RichText>) =
TypeProviderError(errNum, tpDesignation, m, List.ofSeq messages, None, None)

new(errNum, tpDesignation, m, messages: seq<string>) =
TypeProviderError(errNum, tpDesignation, m, messages |> Seq.map RichText.mkText |> List.ofSeq, None, None)

member _.Number = errNum
member _.Range = m

Expand All @@ -50,7 +56,7 @@ type internal TypeProviderError

override this.Message = this.RichMessage.Text

member _.MapText(f, tpDesignation, m) =
member _.MapText(f: RichText -> int * RichText, tpDesignation, m) =
let (errNum: int), _ = f RichText.empty
TypeProviderError(errNum, tpDesignation, m, (Seq.map (f >> snd) errors))

Expand Down Expand Up @@ -110,11 +116,11 @@ 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 -> RichText.mkText (if isNull e.InnerException then e.Message else (e.Message + ": " + e.GetBaseException().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("", "")
let error = RichText.mkText (if isNull e.InnerException then e.Message else (e.Message + ": " + e.GetBaseException().Message))
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
5 changes: 2 additions & 3 deletions src/Compiler/TypedTree/tainted.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ type internal TypeProviderLock =
type internal TypeProviderError =
inherit System.Exception

/// creates new instance of TypeProviderError that represents one error
new: (int * RichText) * string * range -> TypeProviderError

/// creates new instance of TypeProviderError that represents collection of errors
new: (int * string) * string * range -> TypeProviderError
new: int * string * range * seq<RichText> -> TypeProviderError
new: int * string * range * seq<string> -> TypeProviderError

member Number: int

Expand Down
Loading