Try catch block is not handling the error and the error block is not even going inside the error block
Error: Insufficient values in manual scale. 3 needed but only 2 provided.
c("#B71D48","#ECE189") -> colors_set
tryCatch({
iris %>%
ggplot(aes(x=Petal.Length, y=Petal.Width, color=Species))+
geom_point()+
scale_color_manual(values = colors_set)
},error = function(e){
#error handling code
print("inside error")
ggplot() +
theme_void() +
geom_text(aes(0,0) ,
label = "No data",
size=20)+
theme(plot.background = element_rect(fill = "white",color = "#ffbf00", size=7))
})