since toJson function, wrong available functions on error with unknown function

Description

<cfscript> animals = { cow: "moo", pig: "oink", cat: "meow", bird: "chirp" }; // StructKeyList(animals) animalList = animals.toList(); // should be keyList() echo(animalList); </cfscript>

now throws

The function [toList] does not exist in the Object, only the following functions are available: [toJson].

previously it threw

The function [toList] does not exist in the Object, only the following functions are available: [append,clear,copy,count,delete,duplicate,each,every,filter,find,findKey,findValue,insert,isEmpty,keyArray,keyExists,keyList,keyTranslate,len,map,reduce,some,sort,update]

Environment

None

Attachments

2
  • 04 Dec 2020, 10:56 am
  • 04 Dec 2020, 10:55 am

is caused by

relates to

Activity

Show:

Michael Offner 18 December 2020 at 15:20

the message is done with help of ExceptionUtil.similarKeyMessage(…) what need to be changed to ExceptionUtil.similarKeyMessageAndDetail(…) what is used in many places. so if we do that split we should do it for all occurrences, but as part of a different ticket, could you raise a separate ticket for that?

Zac Spitzer 4 December 2020 at 11:24

but can you move the

Only the following functions are available: [append, clear, copy, count, delete, duplicate, each, every, filter, find, findKey, findValue, insert, isEmpty, keyArray, keyExists, keyList, keyTranslate, len, map, reduce, some, sort, toJson, update, valueArray].

to the exception detail? It’s more readable and doesn’t fill up the logs (which are all currently repeated https://luceeserver.atlassian.net/browse/LDEV-2781 )

Michael Offner 4 December 2020 at 11:11

improved the message, if we have the type we show it

 

The function [toList] does not exist in the Struct, only the following functions are available: [append, clear, copy, count, delete, duplicate, each, every, filter, find, findKey, findValue, insert, isEmpty, keyArray, keyExists, keyList, keyTranslate, len, map, reduce, some, sort, toJson, update, valueArray].

so it shows now all functions, it has a space between them and we show the type.

Zac Spitzer 4 December 2020 at 10:55
Edited

sometimes Lucee says object, other times Struct

or Array, it’s just not as immediately clear as it could be. I find always myself asking, what Object? it’s a cfc?

Fixed

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 30 November 2020 at 15:49
Updated 23 March 2021 at 07:15
Resolved 18 December 2020 at 15:21

Flag notifications