ipyannotator icon indicating copy to clipboard operation
ipyannotator copied to clipboard

Improve Ipyannotator API message error

Open itepifanio opened this issue 3 years ago • 0 comments

Ipyannotator has an API to use its previously defined annotators. The API uses a pair of input/output and when this pair it's not configured the API should throw a friendly exception for the user.

Right now when a pair it's not correctly configured the API prints a friendly message (Pair (Annotator Input type: CustomInput, Annotator Output type: NoOutput) is not supported!) but also throws a random exception AttributeError: 'NoneType' object has no attribute 'get_annotator' this behavior can be reproduced using the following code:

from ipyannotator.mltypes import Input, Output
from ipyannotator.annotator import Annotator

class CustomInput(Input):
    pass

custom_input = CustomInput()
annotator = Annotator(custom_input)
annotator.explore()

The expected behavior it's:

  • Ipyannotator throws a friendly custom exception (ex. PairUnsupported)
  • Don't throw the AttributeError

itepifanio avatar Sep 22 '22 17:09 itepifanio