Add logs
This commit is contained in:
		
							parent
							
								
									4c65b0cd6f
								
							
						
					
					
						commit
						4a41d2fddc
					
				
					 1 changed files with 15 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -19,16 +19,20 @@ export default class Resolver {
 | 
			
		|||
			: value;
 | 
			
		||||
 | 
			
		||||
		switch (collection.type) {
 | 
			
		||||
		case 'Collection':
 | 
			
		||||
			collection.objects = collection.items;
 | 
			
		||||
			break;
 | 
			
		||||
			case 'Collection': {
 | 
			
		||||
				collection.objects = collection.items;
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		case 'OrderedCollection':
 | 
			
		||||
			collection.objects = collection.orderedItems;
 | 
			
		||||
			break;
 | 
			
		||||
			case 'OrderedCollection': {
 | 
			
		||||
				collection.objects = collection.orderedItems;
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		default:
 | 
			
		||||
			throw new Error(`unknown collection type: ${collection.type}`);
 | 
			
		||||
			default: {
 | 
			
		||||
				logger.error(`unknown collection type: ${collection.type}`);
 | 
			
		||||
				throw new Error(`unknown collection type: ${collection.type}`);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return collection;
 | 
			
		||||
| 
						 | 
				
			
			@ -36,6 +40,7 @@ export default class Resolver {
 | 
			
		|||
 | 
			
		||||
	public async resolve(value: any): Promise<IObject> {
 | 
			
		||||
		if (value == null) {
 | 
			
		||||
			logger.error('resolvee is null (or undefined)');
 | 
			
		||||
			throw new Error('resolvee is null (or undefined)');
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,6 +49,7 @@ export default class Resolver {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		if (this.history.has(value)) {
 | 
			
		||||
			logger.error(`cannot resolve already resolved one`);
 | 
			
		||||
			throw new Error('cannot resolve already resolved one');
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -59,6 +65,7 @@ export default class Resolver {
 | 
			
		|||
			},
 | 
			
		||||
			json: true
 | 
			
		||||
		}).catch(e => {
 | 
			
		||||
			logger.error(`request error: ${e.message}`);
 | 
			
		||||
			throw new Error(`request error: ${e.message}`);
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue