[libcamera-devel] libcamera: yaml_parser: Report filename on failures
diff mbox series

Message ID 20220808203026.2515013-1-kieran.bingham@ideasonboard.com
State Accepted
Delegated to: Kieran Bingham
Headers show
Series
  • [libcamera-devel] libcamera: yaml_parser: Report filename on failures
Related show

Commit Message

Kieran Bingham Aug. 8, 2022, 8:30 p.m. UTC
It can be helpful to know 'which' file failed to parse if there is a
failure.

Report it to the user in the error message.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---

This was failing for me while adding an IPU3 tuning file - with no
indication as to where to look.

 src/libcamera/yaml_parser.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart Aug. 8, 2022, 8:40 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Mon, Aug 08, 2022 at 09:30:26PM +0100, Kieran Bingham via libcamera-devel wrote:
> It can be helpful to know 'which' file failed to parse if there is a

Or even to know which file failed to parse, without quotes :-)

> failure.
> 
> Report it to the user in the error message.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
> 
> This was failing for me while adding an IPU3 tuning file - with no
> indication as to where to look.
> 
>  src/libcamera/yaml_parser.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp
> index c96e99e1317c..dfbfac304d3d 100644
> --- a/src/libcamera/yaml_parser.cpp
> +++ b/src/libcamera/yaml_parser.cpp
> @@ -807,7 +807,7 @@ std::unique_ptr<YamlObject> YamlParser::parse(File &file)
>  	std::unique_ptr<YamlObject> root(new YamlObject());
>  
>  	if (context.parseContent(*root)) {
> -		LOG(YamlParser, Error) << "Failed to parse YAML content";
> +		LOG(YamlParser, Error) << "Failed to parse YAML content from " << file.fileName();

With the line wrapped

		LOG(YamlParser, Error)
			<< "Failed to parse YAML content from "
			<< file.fileName();

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  		return nullptr;
>  	}
>
Umang Jain Aug. 10, 2022, 7:01 a.m. UTC | #2
Hi Kieran,

Thank you for the patch

On 8/9/22 02:10, Laurent Pinchart via libcamera-devel wrote:
> Hi Kieran,
>
> Thank you for the patch.
>
> On Mon, Aug 08, 2022 at 09:30:26PM +0100, Kieran Bingham via libcamera-devel wrote:
>> It can be helpful to know 'which' file failed to parse if there is a
> Or even to know which file failed to parse, without quotes :-)
>
>> failure.
>>
>> Report it to the user in the error message.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

>> ---
>>
>> This was failing for me while adding an IPU3 tuning file - with no
>> indication as to where to look.
>>
>>   src/libcamera/yaml_parser.cpp | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp
>> index c96e99e1317c..dfbfac304d3d 100644
>> --- a/src/libcamera/yaml_parser.cpp
>> +++ b/src/libcamera/yaml_parser.cpp
>> @@ -807,7 +807,7 @@ std::unique_ptr<YamlObject> YamlParser::parse(File &file)
>>   	std::unique_ptr<YamlObject> root(new YamlObject());
>>   
>>   	if (context.parseContent(*root)) {
>> -		LOG(YamlParser, Error) << "Failed to parse YAML content";
>> +		LOG(YamlParser, Error) << "Failed to parse YAML content from " << file.fileName();
> With the line wrapped
>
> 		LOG(YamlParser, Error)
> 			<< "Failed to parse YAML content from "
> 			<< file.fileName();
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
>>   		return nullptr;
>>   	}
>>

Patch
diff mbox series

diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp
index c96e99e1317c..dfbfac304d3d 100644
--- a/src/libcamera/yaml_parser.cpp
+++ b/src/libcamera/yaml_parser.cpp
@@ -807,7 +807,7 @@  std::unique_ptr<YamlObject> YamlParser::parse(File &file)
 	std::unique_ptr<YamlObject> root(new YamlObject());
 
 	if (context.parseContent(*root)) {
-		LOG(YamlParser, Error) << "Failed to parse YAML content";
+		LOG(YamlParser, Error) << "Failed to parse YAML content from " << file.fileName();
 		return nullptr;
 	}