@@ -418,13 +418,41 @@ defmodule Mix.Release do
418418 :ok
419419
420420 { :error , reason } ->
421- { :error ,
422- "Could not read configuration file. It likely has invalid configuration terms " <>
423- "such as functions, references, and pids. Please make sure your configuration " <>
424- "is made of numbers, atoms, strings, maps, tuples and lists. Reason: #{ inspect ( reason ) } " }
421+ invalid =
422+ for { app , kv } <- sys_config ,
423+ { key , value } <- kv ,
424+ not valid_config? ( value ) ,
425+ do: """
426+
427+ Application: #{ inspect ( app ) }
428+ Key: #{ inspect ( key ) }
429+ Value: #{ inspect ( value ) }
430+ """
431+
432+ message =
433+ case invalid do
434+ [ ] ->
435+ "Could not read configuration file. Reason: #{ inspect ( reason ) } "
436+
437+ _ ->
438+ "Could not read configuration file. It has invalid configuration terms " <>
439+ "such as functions, references, and pids. Please make sure your configuration " <>
440+ "is made of numbers, atoms, strings, maps, tuples and lists. The following entries " <>
441+ "are wrong:\n #{ Enum . join ( invalid ) } "
442+ end
443+
444+ { :error , message }
425445 end
426446 end
427447
448+ defp valid_config? ( n ) when is_number ( n ) , do: true
449+ defp valid_config? ( a ) when is_atom ( a ) , do: true
450+ defp valid_config? ( b ) when is_binary ( b ) , do: true
451+ defp valid_config? ( l ) when is_list ( l ) , do: Enum . all? ( l , & valid_config? / 1 )
452+ defp valid_config? ( m ) when is_map ( m ) , do: Enum . all? ( m , & valid_config? / 1 )
453+ defp valid_config? ( t ) when is_tuple ( t ) , do: Enum . all? ( Tuple . to_list ( t ) , & valid_config? / 1 )
454+ defp valid_config? ( _ ) , do: false
455+
428456 defp merge_provider_config ( % { config_providers: [ ] } , sys_config , _ ) , do: { sys_config , false }
429457
430458 defp merge_provider_config ( release , sys_config , config_path ) do
0 commit comments