Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.
I've tried to make it as lean and unobtrusive as possible.
errors/AppError.js
| #!/usr/bin/env python3.6 | |
| import asyncio | |
| from contextlib import closing | |
| import aiohttp | |
| import tqdm | |
| async def download(session, url, progress_queue): |
| import asyncio | |
| loop = asyncio.get_event_loop() | |
| async def hello(): | |
| await asyncio.sleep(3) | |
| print('Hello!') | |
| if __name__ == '__main__': | |
| loop.run_until_complete(hello()) | |