Check if module failed

Basically I have a script that will run a module made by the community. But with that sometimes the module may error which I will then display an error message on the screen. How am I able to check if the module has failed or errored?

1 Like

you can use pcall to check if module has an error or it didn’t.

local module

local suc, erm = pcall(function()
      module = require(--module)

if not suc then -- checking if it was successfully
     warn(erm)  -- it wasn't successfully, so writing an occured erro
     print("module successfully loaded without any errors")

1 Like