fedimbed: json decode debug
This commit is contained in:
		
							parent
							
								
									fe2a4eb062
								
							
						
					
					
						commit
						a08d44cde0
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -171,7 +171,14 @@ async function processUrl(msg, url, spoiler = false) {
 | 
			
		|||
 | 
			
		||||
  let postData;
 | 
			
		||||
  if (rawPostData?.startsWith("{")) {
 | 
			
		||||
    postData = JSON.parse(rawPostData);
 | 
			
		||||
    try {
 | 
			
		||||
      postData = JSON.parse(rawPostData);
 | 
			
		||||
    } catch (err) {
 | 
			
		||||
      logger.error(
 | 
			
		||||
        "fedimbed",
 | 
			
		||||
        `Failed to decode JSON for "${url}": ${err}\n  "${rawPostData}"`
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    logger.warn("fedimbed", `Got non-JSON for "${url}": ${rawPostData}`);
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue