code: def custom_exception_handler(exc, context):
      """Switch from PNGRenderer to JSONRenderer for exceptions"""
      if context["request"].accepted_renderer.format == "png":
          context["request"].accepted_renderer = JSONRenderer()
  
      return exception_handler(exc, context)
  
file_path: TimeSide/timeside/server/utils.py
imports: import os
  import timeside.core
  import json
  from django.conf import settings
  from timeside.core.api import IEncoder
  from timeside.server.models import Processor, Preset, Result, Task
  from rest_framework.views import exception_handler
  from rest_framework.renderers import BaseRenderer, JSONRenderer
label_desc: Use image node_id 3 for calling a global function with example usage: custom_exception_handler(exc, context) and returns: exception_handler