sendCustomErrorFile method
Implementation
Future<void> sendCustomErrorFile(int code, htmlFile) async {
res?.statusCode = code;
res?.headers.contentType = ContentType.html;
String filepath = Directory.current.path.toString()+'/templates/'+htmlFile;
final File file = File(filepath);
if(await file.exists()){
try{
res?.addStream(file.openRead());
res?.close();
}catch(e){
await sendInternalError();
}
}else{
await sendNotFound();
}
}