Forum Discussion
Ben-Dev
4 years agoHelper II
M Language - Error Records' New Fields (Message.Format & Message.Parameters
Hello, At some point in the not too distant past, error records were expanded from three fields (Reason, Message, Details) to five fields (with the addition of fields Message.Format and Message.P...
- 4 years ago
Your guess is correct. 🙂
Here's an example:
error [ Message.Format = "Hello #{0}.", Message.Parameters = {"world"} ]
Ben-Dev
4 years agoHelper II
Thanks, Ehren, for the quick reply!
A couple questions:
- Are the parameters pared with the {something} placeholders in the message positionally? So the first parameter in the list goes with the first placeholder in the message, the second param with the second placeholder, etc.? (Think the answer is "yes.")
- What is the difference between error fields Message and Message.Format? Error.Record sets them to both be the same value, but I'm guessing they are separate fields because there may be reasons for them to have different values.
- Is there any way to get the mashup engine to fill in the placeholders when rendering the error out in the UI? For example, "error Error.Record("Some Reason", "Some Message - count: {count}, code: {code}", null, {123, "abc"})" is rendered without giving the user any clue as to the placeholder's values. Should the UI be filling in the placeholders when displaying the error?