Backups script completes, but doesn't back up all dbs
The problem may actually be that in using your cursor, you're not encountering errors, but databases are simply getting skipped.  I have had situations in the past where a default cursor will skip records.  I've never been able to determine the cause, but I have found some ways to handle it better in the code.

One is to put some better definition around your cursor declaration.  Since this kind of cursor will always iterate forward, you should declare it as such:

DECLARE db_cursor CURSOR STATIC FAST_FORWARD FOR
SELECT name 
FROM sys.databases
WHERE state_desc = 'ONLINE'
    AND name != 'tempdb'
ORDER name


I have found using the FAST_FORWARD option is much more reliable for iterating each item in a data set.  Also, it can have other benefits.

Another approach is to build a WHILE... loop structure to handle this.  This does not rely on the cursor engine in SQL Server to handle your logic and can give you better reliability for getting all your databases(this is incomplete code, you will need to add backup/error handling logic to make it work):

DECLARE @work table
(dbid int,
 backupdate datetime,
 errormsg varchar(max));

DECLARE @currdb int

INSERT INTO @work (dbid)
SELECT 
    database_id
FROM
    sys.databases a
WHERE
    state_desc = 'ONLINE'
    AND name != 'tempdb'

WHILE EXISTS (SELECT 1 FROM @work WHERE backupdate IS NULL AND errormsg IS NULL)
BEGIN
    SELECT top 1 @currdb = dbid 
    FROM @work 
    WHERE backupdate IS NULL AND errormsg IS NULL; 

    BEGIN TRY
        --Execute Backup Code, then update @work table
        UPDATE @work
        SET backupdate = GETDATE()
        WHERE dbid = @currdb
    END TRY
    BEGIN CATCH
        --Catch error, put message in @work table
        update @work
        set errormsg=ERROR_MESSAGE()
        where dbid = @currdb;
    END CATCH

END


These are two approaches if you decide to move forward with writing your own scripts for backups.  Overall, I would strongly recommend you check out Ola Hallengren's backup scripts.  They are highly recommended by members of the community, well documented, and thoroughly tested.