[pve-devel] [PATCH common 2/4] cleanup: newlines in die/warn

Dietmar Maurer dietmar at proxmox.com
Mon Mar 21 08:07:21 CET 2016


We use two different kinds of error reporting in print_property_string():

die "msg" 

and

raise "format error", errors => $errors;

??


> On March 18, 2016 at 11:38 AM Wolfgang Bumiller <w.bumiller at proxmox.com>
> wrote:
> 
> 
> ---
>  src/PVE/JSONSchema.pm | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
> index ac64342..f9b7a5a 100644
> --- a/src/PVE/JSONSchema.pm
> +++ b/src/PVE/JSONSchema.pm
> @@ -545,7 +545,7 @@ sub print_property_string {
>  
>      if (ref($format) ne 'HASH') {
>  	my $schema = $format_list->{$format};
> -	die "not a valid format: $format" if !$schema;
> +	die "not a valid format: $format\n" if !$schema;
>  	$format = $schema;
>      }
>  
> @@ -568,7 +568,7 @@ sub print_property_string {
>  	# Skip default keys
>  	if ($format->{$key}->{default_key}) {
>  	    if ($default_key) {
> -		warn "multiple default keys in schema ($default_key, $key)";
> +		warn "multiple default keys in schema ($default_key, $key)\n";
>  	    } else {
>  		$default_key = $key;
>  		$skipped{$key} = 1;
> @@ -588,7 +588,7 @@ sub print_property_string {
>      foreach my $key (sort keys %$data) {
>  	delete $required{$key};
>  	next if $skipped{$key};
> -	die "invalid key: $key" if !$allowed{$key};
> +	die "invalid key: $key\n" if !$allowed{$key};
>  
>  	my $typeformat = $format->{$key}->{format};
>  	my $value = $data->{$key};
> @@ -604,7 +604,7 @@ sub print_property_string {
>      }
>  
>      if (my $missing = join(',', keys %required)) {
> -	die "missing properties: $missing";
> +	die "missing properties: $missing\n";
>      }
>  
>      return $text;
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 




More information about the pve-devel mailing list