Trying to get what type of error pcall got

I was wondering if it is possible to detect which type of error pcall has got/outputted?
Sorta like this:

local success, err = pcall(function()
   local fakecharacter = workspace.ThisPartDoesNotExist.Character -- intentional error
end)
if err then
	if err == "attempt to index nil with 'Character'" then return end
	warn(err)
end

If it isn’t possible is there a similar approach to it then?

I’m not sure if this is how pcall supposed to be used (I’ve legitimately never used it), but here is what you’re supposed to do:

local success, err = pcall(function()
   return workspace.ThisPartDoesNotExist.Character -- intentional error
end)
if err then
	if err == "attempt to index nil with 'Character'" then return end
	warn(err)
end