cog icon indicating copy to clipboard operation
cog copied to clipboard

operable:unique fails when value is empty

Open splashx opened this issue 8 years ago • 2 comments

dio: !ec2:instance-list | raw | echo $security_groups

cog APP:

[]
[]
[]
[{"group_name":"launch-wizard-1","group_id":"sg-6cb8d309"}]
[]

dio: !ec2:instance-list | echo $security_groups | unique | raw

cog APP:

It appears that the `operable:unique` command crashed while executing, with the following error:

`%CaseClauseError{term: ""}`

Here is the stacktrace at the point where the crash occurred. This information can help the authors of the command determine the ultimate cause for the crash.

```  [file: 'lib/cog/commands/unique.ex', line: 25]},
 {Cog.Command.GenCommand, :process_message, 3,
  [file: 'lib/cog/command/gen_command.ex', line: 188]},
 {Cog.Command.GenCommand, :handle_info, 2,
  [file: 'lib/cog/command/gen_command.ex', line: 163]},
 {:gen_server, :try_dispatch, 4, [file: 'gen_server.erl', line: 601]},
 {:gen_server, :handle_msg, 5, [file: 'gen_server.erl', line: 667]},
 {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}]``````

splashx avatar Jun 07 '17 20:06 splashx

Looks like a bug in how steps are named, at some point it was "first", nil, "last" but now it seems the nil could be "".

I have a quick fix for this command but would like to look into what changed to cause this and maybe fix it there instead.

nmohoric avatar Aug 28 '17 11:08 nmohoric

I've just bumped into a unique problem again. Funny thing someone has not reported it because the seed built-in command uses unique as an example and that example will crash sonia:

dio [11:29 PM] 
seed ‘[{“a”: 1}, {“a”: 3}, {“a”: 1}]’ | unique

bot APP [11:29 PM] 
It appears that the `operable:unique` command crashed while executing, with the following error:

`%CaseClauseError{term: ""}`

Here is the stacktrace at the point where the crash occurred. This information can help the authors of the command determine the ultimate cause for the crash.

```  [file: 'lib/cog/commands/unique.ex', line: 25]},
 {Cog.Command.GenCommand, :process_message, 3,
  [file: 'lib/cog/command/gen_command.ex', line: 188]},
 {Cog.Command.GenCommand, :handle_info, 2,
  [file: 'lib/cog/command/gen_command.ex', line: 163]},
 {:gen_server, :try_dispatch, 4, [file: 'gen_server.erl', line: 601]},
 {:gen_server, :handle_msg, 5, [file: 'gen_server.erl', line: 667]},
 {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}]``````

splashx avatar Oct 16 '17 21:10 splashx